Last active
November 22, 2015 16:16
-
-
Save lvjp/bf1ffc8a037f53cf90b1 to your computer and use it in GitHub Desktop.
Terraform cycle with aws_elb security_group
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
# vim:set ts=4 sw=4 tw=80 et: | |
resource "aws_vpc" "test" { | |
cidr_block = "10.0.0.0/16" | |
enable_dns_support = true | |
enable_dns_hostnames = true | |
} | |
resource "aws_internet_gateway" "test" { | |
vpc_id = "${aws_vpc.test.id}" | |
} | |
resource "aws_subnet" "test" { | |
vpc_id = "${aws_vpc.test.id}" | |
cidr_block = "10.0.1.0/24" | |
} | |
resource "aws_instance" "test" { | |
# Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type | |
ami = "ami-383c1956" | |
instance_type = "t2.micro" | |
subnet_id = "${aws_subnet.test.id}" | |
security_groups = [ "${aws_security_group.test.id}" ] | |
} | |
resource "aws_elb" "test" { | |
name = "test" | |
subnets = [ "${aws_subnet.test.id}" ] | |
listener { | |
instance_port = 5672 | |
instance_protocol = "tcp" | |
lb_port = 5672 | |
lb_protocol = "tcp" | |
} | |
instances = [ "${aws_instance.test.id}" ] | |
} | |
resource "aws_security_group" "test" { | |
name = "test" | |
vpc_id = "${aws_vpc.test.id}" | |
ingress { | |
protocol = "tcp" | |
# Cannot use ${aws_elb.test.source_security_group due tue #2420 | |
security_groups = [ "${aws_elb.test.source_security_group}" ] | |
from_port = 80 | |
to_port = 80 | |
} | |
} | |
provider "aws" { | |
# Provice region, access_key, secret_key with environment variables | |
# AWS_DEFAULT_REGION | |
# AWS_ACCESS_KEY_ID | |
# AWS_SECRET_ACCESS_KEY | |
} |
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
There are warnings and/or errors related to your configuration. Please | |
fix these before continuing. | |
Errors: | |
* 1 error(s) occurred: | |
* Cycle: aws_instance.test, aws_elb.test, aws_security_group.test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment