Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tf-apply-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
id: check
run: |
echo ${{ env.ACCOUNT_ID }}
aws s3api head-object --bucket do-not-delete-awsgoat-state-files-${{ env.ACCOUNT_ID }} --key terraform.tfstate
aws s3api head-object --bucket do-not-delete-awsgoat-state-files-${{ github.event.inputs.module }}-${{ env.ACCOUNT_ID }} --key terraform.tfstate
continue-on-error: true

- name: Exit if previous deployment exists
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
if: always()
run: |
cd modules/${{ github.event.inputs.module }}
aws s3 cp ./terraform.tfstate s3://do-not-delete-awsgoat-state-files-${{ env.ACCOUNT_ID }}/terraform.tfstate
aws s3 cp ./terraform.tfstate s3://do-not-delete-awsgoat-state-files-${{ github.event.inputs.module }}-${{ env.ACCOUNT_ID }}/terraform.tfstate

# Terraform Output the API Gateway url
- name: Application URL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tf-destroy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Retrieve tfstate
run: |
cd modules/${{ github.event.inputs.module }}
aws s3 cp s3://do-not-delete-awsgoat-state-files-${{ env.ACCOUNT_ID }}/terraform.tfstate ./terraform.tfstate
aws s3 cp s3://do-not-delete-awsgoat-state-files-${{ github.event.inputs.module }}-${{ env.ACCOUNT_ID }}/terraform.tfstate ./terraform.tfstate

# Initialize a new Terraform working directory
- name: Terraform Init
Expand Down
4 changes: 2 additions & 2 deletions modules/module-1/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,7 @@ resource "aws_s3_object" "upload_temp_object_2" {
}
/* Creating a S3 Bucket for Terraform state file upload. */
resource "aws_s3_bucket" "bucket_tf_files" {
bucket = "do-not-delete-awsgoat-state-files-${data.aws_caller_identity.current.account_id}"
bucket = "do-not-delete-awsgoat-state-files-module-1-${data.aws_caller_identity.current.account_id}"
force_destroy = true
tags = {
Name = "Do not delete Bucket"
Expand Down Expand Up @@ -3598,7 +3598,7 @@ data "aws_ami" "goat_ami" {

resource "aws_instance" "goat_instance" {
ami = data.aws_ami.goat_ami.id
instance_type = "t2.micro"
instance_type = "t3.micro"
iam_instance_profile = aws_iam_instance_profile.goat_iam_profile.name
subnet_id = aws_subnet.goat_subnet.id
security_groups = [aws_security_group.goat_sg.id]
Expand Down
4 changes: 2 additions & 2 deletions modules/module-2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ data "aws_ami" "ecs_optimized_ami" {
resource "aws_launch_template" "ecs_launch_template" {
name_prefix = "ecs-launch-template-"
image_id = data.aws_ami.ecs_optimized_ami.id
instance_type = "t2.micro"
instance_type = "t3.micro"

iam_instance_profile {
name = aws_iam_instance_profile.ecs-instance-profile.name
Expand Down Expand Up @@ -514,7 +514,7 @@ EOF

/* Creating a S3 Bucket for Terraform state file upload. */
resource "aws_s3_bucket" "bucket_tf_files" {
bucket = "do-not-delete-awsgoat-state-files-${data.aws_caller_identity.current.account_id}"
bucket = "do-not-delete-awsgoat-state-files-module-2-${data.aws_caller_identity.current.account_id}"
force_destroy = true
tags = {
Name = "Do not delete Bucket"
Expand Down