Skip to content

Commit

Permalink
final fixes, remove tf files
Browse files Browse the repository at this point in the history
  • Loading branch information
KyMidd committed Nov 29, 2019
1 parent 90923b9 commit 9aa8bc2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 168 deletions.
21 changes: 8 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
# Require TF version to be same as or greater than 0.12.16
terraform {
required_version = ">=0.12.16"
/*
backend "s3" {
bucket = "kyler-codebuild-demo-terraform-tfstate"
key = "terraform.tfstate"
region = "us-east-1"
dynamodb_table = "codebuild-dynamodb-terraform-locking"
encrypt = true
}
*/
}

# Download any stable version in AWS provider of 2.36.0 or higher in 2.36 train
provider "aws" {
region = "us-east-1"
version = "~> 2.36.0"
/*
assume_role {
# Remember to update this account ID to yours
role_arn = "arn:aws:iam::718626770228:role/TerraformAssumedIamRole"
session_name = "terraform"
}
*/
}


## Step 1: Build an IAM user with administrative rights
# Export the access key and secret access key into global bash variables. The commands will look like this:
# export AWS_ACCESS_KEY_ID="AKIA2OULU2K4324HLYFNU"
# export AWS_SECRET_ACCESS_KEY="b8ma12345678901234567890toWCOjo"


## Step 2: Build an S3 bucket and DynamoDB for Terraform state and locking
## Build an S3 bucket and DynamoDB for Terraform state and locking
module "bootstrap" {
source = "./modules/bootstrap"
s3_tfstate_bucket = "kyler-codebuild-demo-terraform-tfstate"
Expand All @@ -40,14 +37,13 @@ module "bootstrap" {
tf_codepipeline_artifact_bucket_arn = module.codepipeline.tf_codepipeline_artifact_bucket_arn
}

## Step 3: Build a CodeCommit git repo
## Build a CodeCommit git repo
module "codecommit" {
source = "./modules/codecommit"
repository_name = "CodeCommitTerraform"
}


## Step 4: Build CodeBuild projects for Terraform Plan and Terraform Apply
## Build CodeBuild projects for Terraform Plan and Terraform Apply
module "codebuild" {
source = "./modules/codebuild"
codebuild_project_terraform_plan_name = "TerraformPlan"
Expand All @@ -57,8 +53,7 @@ module "codebuild" {
s3_logging_bucket = module.bootstrap.s3_logging_bucket
}


## Step 5: Build a CodePipeline
## Build a CodePipeline
module "codepipeline" {
source = "./modules/codepipeline"
tf_codepipeline_name = "TerraformCodePipeline"
Expand Down
17 changes: 0 additions & 17 deletions modules/bootstrap/bootstrap.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ resource "aws_s3_bucket" "state_bucket" {
}
}

# Prevents Terraform from destroying or replacing this object - a great safety mechanism
lifecycle {
prevent_destroy = true
}

# Tells AWS to keep a version history of the state file
versioning {
enabled = true
Expand Down Expand Up @@ -195,10 +190,6 @@ resource "aws_iam_role" "tf_iam_assumed_role" {
}
EOF

lifecycle {
prevent_destroy = true
}

tags = {
Terraform = "true"
}
Expand All @@ -224,18 +215,10 @@ resource "aws_iam_policy" "tf_iam_assumed_policy" {
]
}
EOF

lifecycle {
prevent_destroy = true
}
}

# Attach IAM assume role to policy
resource "aws_iam_role_policy_attachment" "tf_iam_attach_assumed_role_to_permissions_policy" {
role = aws_iam_role.tf_iam_assumed_role.name
policy_arn = aws_iam_policy.tf_iam_assumed_policy.arn

lifecycle {
prevent_destroy = true
}
}
18 changes: 0 additions & 18 deletions modules/codepipeline/codepipeline.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,21 +261,3 @@ stage {
}
}
}

/*
resource "aws_codepipeline_webhook" "webhook" {
name = module.codepipeline_label.id
authentication = var.webhook_authentication
target_action = var.webhook_target_action
target_pipeline = join("", aws_codepipeline.default.*.name)
authentication_configuration {
secret_token = local.webhook_secret
}
filter {
json_path = var.webhook_filter_json_path
match_equals = var.webhook_filter_match_equals
}
}
*/
Empty file removed terraform.tfstate
Empty file.
120 changes: 0 additions & 120 deletions terraform.tfstate.backup

This file was deleted.

0 comments on commit 9aa8bc2

Please sign in to comment.