No Description

Camilla 8df5f8fc58 [Camilla] Example of variables and security group 2 years ago
..
.gitignore 3f70ce512e [Camilla] Adds tag name to EC2 instance 2 years ago
README.md 8df5f8fc58 [Camilla] Example of variables and security group 2 years ago
main.tf 8df5f8fc58 [Camilla] Example of variables and security group 2 years ago

README.md

Terraform Spike

Setup Terraform on your machine

brew install terraform

Make sure you have AWS CLI setup.

Hello world example

touch main.tf
atom main.tf

Paste in the following code to create a simple EC2 Instance (replace with correct ami):

resource "aws_instance" "example" {
  ami = "ami-95f8d2f3"
  instance_type = "t2.micro"

  tags {
    Name = "terraform-hello-world"
  }
}

Terraform plan allows you to see what Terraform would do before actually running the file:

terraform plan

If asked, the AWS region used for Decode project is eu-west-1.

To actually run the file:

terraform apply

To pass Terraform a variable via command line

terraform plan -var server_port="8080"

Resources