2015-10-25 14:51:18 +00:00
|
|
|
// This comes from Terraform, as a test
|
|
|
|
variable "foo" {
|
2015-10-25 15:18:26 +00:00
|
|
|
default = "bar"
|
|
|
|
description = "bar"
|
2015-10-25 14:51:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
provider "aws" {
|
2015-10-25 15:18:26 +00:00
|
|
|
access_key ="foo"
|
|
|
|
secret_key = "bar"
|
2015-10-25 14:51:18 +00:00
|
|
|
}
|
|
|
|
|
2015-10-25 15:18:26 +00:00
|
|
|
provider "do" {
|
2015-10-25 14:51:18 +00:00
|
|
|
api_key = "${var.foo}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_security_group" "firewall" {
|
2015-10-25 15:18:26 +00:00
|
|
|
count = 5
|
|
|
|
}
|
|
|
|
|
|
|
|
resource aws_instance "web" {
|
|
|
|
ami = "${var.foo}"
|
|
|
|
security_groups = [
|
|
|
|
"foo",
|
|
|
|
"${aws_security_group.firewall.foo}"
|
|
|
|
]
|
|
|
|
|
|
|
|
network_interface {
|
|
|
|
device_index = 0
|
|
|
|
description = "Main network interface"
|
|
|
|
}
|
2015-10-25 14:51:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "db" {
|
2015-10-25 15:18:26 +00:00
|
|
|
security_groups = "${aws_security_group.firewall.*.id}"
|
2015-10-25 14:51:18 +00:00
|
|
|
VPC = "foo"
|
|
|
|
|
|
|
|
depends_on = ["aws_instance.web"]
|
2015-10-25 15:18:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-25 14:51:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
output "web_ip" {
|
2015-10-25 15:18:26 +00:00
|
|
|
|
|
|
|
value="${aws_instance.web.private_ip}"
|
2015-10-25 14:51:18 +00:00
|
|
|
}
|