-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathMayankSingh_850630.tf
71 lines (47 loc) · 2 KB
/
MayankSingh_850630.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
#Create a template for running a simple two-tier architecture on Amazon Web services.
#The premise is that you have stateless app servers running behind an ELB serving traffic.
#__________________________________________________________________________________________
#Variables are declared in variables.tf file
variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "aws_region" {}
#============================================================================================
/*
We can put the value of variables at the runtime by initializing the TF_VAR_variable_name as evnironment variable
$ set TF_VAR_aws_access_key=<access_key>
$ set TF_VAR_aws_secret_key=<secret_key>
*/
#This is the main file headfile.tf
#--------------------------------------------------------------------------------------------
provider "aws" {
access_key="${var.aws_access_key}"
secret_key="${var.aws_secret_key}"
region="${aws_region}"
}
#--------------------------------------------------------------------------------------------
resource "aws_instance" "mayank_web_server" {
ami="ami-0a74bfeb190bd404f"
instance_type="t2.micro"
}
#-------------------------------------------------------------------------------------------
resource "aws_elb" "test" {
#<attributes>=<value>
}
#-------------------------------------------------------------------------------------------
resource "aws_vpc" "test_vpn"{
#<attributes>=<value>
}
#--------------------------------------------------------------------------------------------
resource "aws_gateway" "mayank_gateway" {
}
#--------------------------------------------------------------------------------------------
resource "aws_key_pair" "auth" {
key_name = "${var.key_name}"
public_key = "${file(var.public_key_path)}"
}
#---------------------------------------------------------------------------------------------
provisioner "remote-exec" {
inline = [
]
}
#---------------------------------------------------------------------------------------------