-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy path850979-K.MADHAVA_SAI_KUMAR.tf
75 lines (64 loc) · 1.22 KB
/
850979-K.MADHAVA_SAI_KUMAR.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
73
74
75
terraform{
version="0.11.11"
}
variable "aws_access_key" {}
variable "aws_secret_key"{}
variable "aws_region"{
type="map"
default="ap-south-1"
}
aws_region{
us-east-1="ami-......"
us-west-1="ami-......"
ap-south-1="ami-......"
ap-west-1="ami-......"
}
variable "pair" {
type="map"
default{
"$(var.key_values)"="$(var.pairs)"
}
}
key_values{
default=" "
}
pairs{
default=" "
}
provider "aws" {
access_key="${var.aws_access_key}"
secret_key="${var.aws_secret_key}"
region="${var.aws_region}"
}
resource "aws_instance" "inst" {
ami="${lookup(var.aws_region,aws_region)}"
instance_type="t2.micro"
provisioner "remote-exec"{
inline={
command="$(aws_instance.inst.private_ip)"
}
}
}
data "template" "temp1" {
value="${aws_instance.inst.temp1}"
}
connection{
type="ssh"
user="my_user"
private_ip="$(aws_instance.inst.private_ip)"
}
ingress{
from="0"
to="22"
cidr="[0.0.0.0/0]"
protocol="tcp"
}
outgress{
from="0"
to="0"
cidr="[10.0.0.1/16]"
}
module "vpc" {
source = "$(path(aws_instance)/p.tpl)"
enable_nat_gateway=true
}