-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
60 lines (50 loc) · 1.95 KB
/
s3.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
########################
# S3 bucket to store CFN templates
########################
resource "aws_s3_bucket" "cfn_templates" {
bucket = var.cfn_templates_bucket
}
resource "aws_s3_bucket_versioning" "cfn_templates" {
bucket = aws_s3_bucket.cfn_templates.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_policy" "cfn_templates" {
bucket = aws_s3_bucket.cfn_templates.id
policy = data.template_file.cfn_templates_bucket-policy.rendered
}
resource "aws_s3_object" "codepipeline_template" {
bucket = aws_s3_bucket.cfn_templates.id
key = "aft-feature-branch-codepipeline.yaml"
source = "./cfn_templates/aft-feature-branch-codepipeline.yaml"
etag = "${filemd5("./cfn_templates/aft-feature-branch-codepipeline.yaml")}"
}
resource "aws_s3_object" "buildspec_file_account_tf_plan" {
bucket = aws_s3_bucket.cfn_templates.id
key = "buildspec/tf-plan-account-customizations.yaml"
source = "./cfn_templates/tf-plan-account-customizations.yaml"
etag = "${filemd5("./cfn_templates/tf-plan-account-customizations.yaml")}"
}
resource "aws_s3_object" "buildspec_file_global_tf_plan" {
bucket = aws_s3_bucket.cfn_templates.id
key = "buildspec/tf-plan-global-customizations.yaml"
source = "./cfn_templates/tf-plan-global-customizations.yaml"
etag = "${filemd5("./cfn_templates/tf-plan-global-customizations.yaml")}"
}
########################
# S3 bucket to store CodePipeline Artifacts
########################
resource "aws_s3_bucket" "codepipeline_artifacts" {
bucket = var.codepipeline_artifacts_bucket
}
resource "aws_s3_bucket_versioning" "codepipeline_artifacts" {
bucket = aws_s3_bucket.codepipeline_artifacts.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_policy" "codepipeline_artifacts" {
bucket = aws_s3_bucket.codepipeline_artifacts.id
policy = data.template_file.codepipeline_artifacts_bucket-policy.rendered
}