Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sspier/terraform-aws-starter-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-starter-stack

A Hello World of Terraform.

  • This version creates a single EC2 instance in the default VPC using Terraform. The instance runs a tiny HTTP server that serves a simple hello page.

Prerequisites

  • Terraform 1.8 or later
  • An AWS account
  • AWS credentials configured locally (for example with aws configure, environment variables, or AWS SSO)

Files

  • providers.tf
    Configures the AWS provider and region, and sets default tags.
  • variables.tf
    Defines input variables such as the EC2 instance type.
  • main.tf
    Looks up a recent Amazon Linux 2 AMI and creates a single EC2 instance with a small HTTP server.
  • outputs.tf
    Prints the public IP and DNS of the instance after apply.

Usage

Initialize Terraform:

terraform init

Format and validate configuration:

terraform fmt
terraform validate

See what Terraform plans to create:

terraform plan

Apply the changes:

terraform apply

Type yes to confirm. When the apply completes, Terraform will output the instance_public_ip and instance_public_dns values.

Open the DNS name in your browser:

http://<instance_public_dns>

You should see:

Hello from terraform-aws-starter-stack!

To clean everything up:

terraform destroy

About

A Hello World for Terraform infra

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages