Skip to content

Commit 9aa8bc2

Browse files
committed
final fixes, remove tf files
1 parent 90923b9 commit 9aa8bc2

File tree

5 files changed

+8
-168
lines changed

5 files changed

+8
-168
lines changed

main.tf

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
# Require TF version to be same as or greater than 0.12.16
22
terraform {
33
required_version = ">=0.12.16"
4+
/*
45
backend "s3" {
56
bucket = "kyler-codebuild-demo-terraform-tfstate"
67
key = "terraform.tfstate"
78
region = "us-east-1"
89
dynamodb_table = "codebuild-dynamodb-terraform-locking"
910
encrypt = true
1011
}
12+
*/
1113
}
1214

1315
# Download any stable version in AWS provider of 2.36.0 or higher in 2.36 train
1416
provider "aws" {
1517
region = "us-east-1"
1618
version = "~> 2.36.0"
19+
/*
1720
assume_role {
1821
# Remember to update this account ID to yours
1922
role_arn = "arn:aws:iam::718626770228:role/TerraformAssumedIamRole"
2023
session_name = "terraform"
2124
}
25+
*/
2226
}
2327

24-
25-
## Step 1: Build an IAM user with administrative rights
26-
# Export the access key and secret access key into global bash variables. The commands will look like this:
27-
# export AWS_ACCESS_KEY_ID="AKIA2OULU2K4324HLYFNU"
28-
# export AWS_SECRET_ACCESS_KEY="b8ma12345678901234567890toWCOjo"
29-
30-
31-
## Step 2: Build an S3 bucket and DynamoDB for Terraform state and locking
28+
## Build an S3 bucket and DynamoDB for Terraform state and locking
3229
module "bootstrap" {
3330
source = "./modules/bootstrap"
3431
s3_tfstate_bucket = "kyler-codebuild-demo-terraform-tfstate"
@@ -40,14 +37,13 @@ module "bootstrap" {
4037
tf_codepipeline_artifact_bucket_arn = module.codepipeline.tf_codepipeline_artifact_bucket_arn
4138
}
4239

43-
## Step 3: Build a CodeCommit git repo
40+
## Build a CodeCommit git repo
4441
module "codecommit" {
4542
source = "./modules/codecommit"
4643
repository_name = "CodeCommitTerraform"
4744
}
4845

49-
50-
## Step 4: Build CodeBuild projects for Terraform Plan and Terraform Apply
46+
## Build CodeBuild projects for Terraform Plan and Terraform Apply
5147
module "codebuild" {
5248
source = "./modules/codebuild"
5349
codebuild_project_terraform_plan_name = "TerraformPlan"
@@ -57,8 +53,7 @@ module "codebuild" {
5753
s3_logging_bucket = module.bootstrap.s3_logging_bucket
5854
}
5955

60-
61-
## Step 5: Build a CodePipeline
56+
## Build a CodePipeline
6257
module "codepipeline" {
6358
source = "./modules/codepipeline"
6459
tf_codepipeline_name = "TerraformCodePipeline"

modules/bootstrap/bootstrap.tf

-17
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ resource "aws_s3_bucket" "state_bucket" {
1515
}
1616
}
1717

18-
# Prevents Terraform from destroying or replacing this object - a great safety mechanism
19-
lifecycle {
20-
prevent_destroy = true
21-
}
22-
2318
# Tells AWS to keep a version history of the state file
2419
versioning {
2520
enabled = true
@@ -195,10 +190,6 @@ resource "aws_iam_role" "tf_iam_assumed_role" {
195190
}
196191
EOF
197192

198-
lifecycle {
199-
prevent_destroy = true
200-
}
201-
202193
tags = {
203194
Terraform = "true"
204195
}
@@ -224,18 +215,10 @@ resource "aws_iam_policy" "tf_iam_assumed_policy" {
224215
]
225216
}
226217
EOF
227-
228-
lifecycle {
229-
prevent_destroy = true
230-
}
231218
}
232219

233220
# Attach IAM assume role to policy
234221
resource "aws_iam_role_policy_attachment" "tf_iam_attach_assumed_role_to_permissions_policy" {
235222
role = aws_iam_role.tf_iam_assumed_role.name
236223
policy_arn = aws_iam_policy.tf_iam_assumed_policy.arn
237-
238-
lifecycle {
239-
prevent_destroy = true
240-
}
241224
}

modules/codepipeline/codepipeline.tf

-18
Original file line numberDiff line numberDiff line change
@@ -261,21 +261,3 @@ stage {
261261
}
262262
}
263263
}
264-
265-
/*
266-
resource "aws_codepipeline_webhook" "webhook" {
267-
name = module.codepipeline_label.id
268-
authentication = var.webhook_authentication
269-
target_action = var.webhook_target_action
270-
target_pipeline = join("", aws_codepipeline.default.*.name)
271-
272-
authentication_configuration {
273-
secret_token = local.webhook_secret
274-
}
275-
276-
filter {
277-
json_path = var.webhook_filter_json_path
278-
match_equals = var.webhook_filter_match_equals
279-
}
280-
}
281-
*/

terraform.tfstate

Whitespace-only changes.

terraform.tfstate.backup

-120
This file was deleted.

0 commit comments

Comments
 (0)