Created
May 28, 2015 23:18
-
-
Save inferiorhumanorgans/892008bd3fc1b543fe6b to your computer and use it in GitHub Desktop.
Terraform discreet state files w/ interpolation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "unique" {} | |
variable "cidr" {} | |
provider "aws" { | |
region="us-east-1" | |
secret_key="" | |
access_key="" | |
} | |
resource "aws_security_group" "default" { | |
name = "terraform_example_${var.unique}" | |
description = "Used in the terraform" | |
vpc_id = "vpc-30NNNNNN" | |
egress { | |
from_port = 0 | |
to_port = 65535 | |
protocol = "tcp" | |
cidr_blocks = ["${var.cidr}"] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"serial": 2, | |
"modules": [ | |
{ | |
"path": [ | |
"root" | |
], | |
"outputs": {}, | |
"resources": { | |
"aws_security_group.default": { | |
"type": "aws_security_group", | |
"primary": { | |
"id": "sg-d4NNNNNN", | |
"attributes": { | |
"description": "Used in the terraform", | |
"egress.#": "1", | |
"egress.3254927904.cidr_blocks.#": "1", | |
"egress.3254927904.cidr_blocks.0": "10.1.0.0/16", | |
"egress.3254927904.from_port": "0", | |
"egress.3254927904.protocol": "tcp", | |
"egress.3254927904.security_groups.#": "0", | |
"egress.3254927904.self": "false", | |
"egress.3254927904.to_port": "65535", | |
"id": "sg-d4NNNNNN", | |
"ingress.#": "0", | |
"name": "terraform_example_prod", | |
"owner_id": "NNNNNNNNNNNN", | |
"tags.#": "0", | |
"vpc_id": "vpc-30NNNNNN" | |
} | |
} | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unique = "prod" | |
cidr = "10.1.0.0/16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"serial": 5, | |
"modules": [ | |
{ | |
"path": [ | |
"root" | |
], | |
"outputs": {}, | |
"resources": { | |
"aws_security_group.default": { | |
"type": "aws_security_group", | |
"primary": { | |
"id": "sg-ccNNNNNN", | |
"attributes": { | |
"description": "Used in the terraform", | |
"egress.#": "1", | |
"egress.4220485349.cidr_blocks.#": "1", | |
"egress.4220485349.cidr_blocks.0": "10.2.0.0/16", | |
"egress.4220485349.from_port": "0", | |
"egress.4220485349.protocol": "tcp", | |
"egress.4220485349.security_groups.#": "0", | |
"egress.4220485349.self": "false", | |
"egress.4220485349.to_port": "65535", | |
"id": "sg-ccNNNNNN", | |
"ingress.#": "0", | |
"name": "terraform_example_staging", | |
"owner_id": "NNNNNNNNNNNN", | |
"tags.#": "0", | |
"vpc_id": "vpc-30NNNNNN" | |
} | |
} | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unique = "staging" | |
cidr = "10.2.0.0/16" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment