| 1 | <h2>Comments</h2> |
| 2 | <pre><code># Configure the AWS Provider |
| 3 | // Configure the AWS Provider |
| 4 | </code></pre> |
| 5 | |
| 6 | <h2>Resources</h2> |
| 7 | <pre><code>resource "aws_instance" "web" { |
| 8 | ami = "${data.aws_ami.ubuntu.id}" |
| 9 | instance_type = "t2.micro" |
| 10 | |
| 11 | tags { |
| 12 | Name = "HelloWorld" |
| 13 | } |
| 14 | }</code></pre> |
| 15 | |
| 16 | <h2>Provider</h2> |
| 17 | <pre><code>provider "aws" { |
| 18 | access_key = "${var.aws_access_key}" |
| 19 | secret_key = "${var.aws_secret_key}" |
| 20 | region = "us-east-1" |
| 21 | }</code></pre> |
| 22 | |
| 23 | <h2>Variables</h2> |
| 24 | <pre><code>variable "images" { |
| 25 | type = "map" |
| 26 | |
| 27 | default = { |
| 28 | us-east-1 = "image-1234" |
| 29 | us-west-2 = "image-4567" |
| 30 | } |
| 31 | }</code></pre> |
| 32 | |
| 33 | <h2>Outputs</h2> |
| 34 | <pre><code>output "address" { |
| 35 | value = "${aws_instance.db.public_dns}" |
| 36 | }</code></pre> |
| 37 | |
| 38 | <h2>Modules</h2> |
| 39 | <pre><code>module "consul" { |
| 40 | source = "hashicorp/consul/aws" |
| 41 | servers = 5 |
| 42 | }</code></pre> |