forked from arocki7/terraform-aws-lamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
62 lines (45 loc) · 1.13 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
# Configuring the AWS Provider
provider "aws" {
region = "${var.region}"
access_key = ""
secret_key = ""
}
resource "aws_s3_bucket" "terraform_tf" {
bucket = "ashutosh-lamp-tf"
}
resource "aws_s3_bucket_versioning" "terraform_tf" {
bucket = aws_s3_bucket.terraform_tf.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "terraform_tf" {
bucket = aws_s3_bucket.terraform_tf.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
resource "aws_dynamodb_table" "terraform-lock" {
name = "ashu-tf-lock"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}
module "web" {
source = "./modules/web"
key_name = "${var.key_name}"
subnet_id = "${aws_subnet.tf-web.id}"
vpc_id = "${aws_vpc.tf-vpc.id}"
}
module "db" {
source = "./modules/db"
key_name = "${var.key_name}"
subnet_id = "${aws_subnet.tf-db.id}"
vpc_id = "${aws_vpc.tf-vpc.id}"
sg_tf_web = "${module.web.sg_tf_web}"
}