-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
72 lines (62 loc) · 1.17 KB
/
main.tf
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
#
# DO NOT DELETE THESE LINES!
#
# Your AMI ID is:
#
# ami-eea9f38e
#
# Your subnet ID is:
#
# subnet-b30f9ceb
#
# Your security group ID is:
#
# sg-834d35e4
#
# Your Identity is:
#
# autodesk-cobra
#
variable "aws_access_key" {
type = "string"
}
variable "aws_secret_key" {
type = "string"
}
variable "aws_region" {
type = "string"
default = "us-west-1"
}
variable "instance_count" {
type = "string"
default = "3"
}
terraform {
backend "atlas" {
name = "gopinatht/training"
}
}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}
resource "aws_instance" "web" {
# ...
count = "${var.instance_count}"
ami = "ami-eea9f38e"
instance_type = "t2.micro"
subnet_id = "subnet-b30f9ceb"
vpc_security_group_ids = ["sg-834d35e4"]
tags {
Identity = "autodesk-cobra"
Name = "web ${count.index + 1}/${var.instance_count}"
Company = "Autodesk Inc."
}
}
output "public_ip" {
value = ["${aws_instance.web.*.public_ip}"]
}
output "public_dns" {
value = ["${aws_instance.web.*.public_dns}"]
}