-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.subnet-wrong.tf.bak
91 lines (70 loc) · 1.81 KB
/
main.subnet-wrong.tf.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
provider "aws" {
region = "us-east-1"
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "virtualization-type"
values = ["hvm"]
}
#owners = ["099720109477"] # Canonical
}
variable "instance_ips" {
default = {
"0" = "10.0.0.10"
"1" = "10.0.0.11"
"2" = "10.0.0.12"
"3" = "10.0.0.13"
}
}
resource "aws_instance" "web_server" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "t2.micro"
#vpc_security_group_ids = ["${aws_security_group.instance.id}"]
count = 4
private_ip = "${lookup(var.instance_ips, count.index)}"
# Don't add spaces after EOF
user_data = <<-EOF
echo "Hello, world my new instance." > index.html
nohup busybox httpd -f -p 8080 &
EOF
tags {
name = "myTag"
Name = "Web-Server${count.index}"
}
}
/*
resource "aws_vpc" "my-virtual-private-cloud" {
cidr_block = "10.20.30.100/16"
tags {
Name = "MyTerraform-vpc"
}
}
resource "aws_subnet" "my_subnet" {
vpc_id = "aws_vpc.my-virtual-private-cloud.id"
cidr_block = "10.20.30.100/24"
aws_availability_zones = "us-east-1"
tags {
Name = "my_subnet-terraform"
}
}
resource "aws_network_interface" "my_network_eth" {
subnet_id = "${aws_subnet.my_subnet.id}"
private_ips = ["10.20.30.100"]
tags {
}
}
*/
# resource "aws_security_group" "instance" {
# name = "terraform-example-instance"
# #vpc_id = "my-virtual-private-cloud"
# ingress {
# from_port = "${var.server_port}"
# to_port = "${var.server_port}"
# protocol = "tcp"
# cidr_blocks = ["10.20.30.100/32"]
# }
# }
#data "aws_availability_zones" "all" {}