diff --git a/.github/workflows/terraform-apply.yaml b/.github/workflows/terraform-apply.yaml index b059069..589871e 100644 --- a/.github/workflows/terraform-apply.yaml +++ b/.github/workflows/terraform-apply.yaml @@ -32,3 +32,4 @@ jobs: uses: dflook/terraform-apply@v1 with: path: terraform + backend_config_file: prod.backend.tfvars diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 0210fe6..d07aa0c 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -32,3 +32,4 @@ jobs: uses: dflook/terraform-plan@v1 with: path: terraform + backend_config_file: prod.backend.tfvars diff --git a/.gitignore b/.gitignore index 0d16693..e09d516 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ # Ignore variables files *.auto.tfvars +# Ignore local development variable file +backend.tfvars + # Ignore override files *.tfoverride diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c00f328..cccc632 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -242,7 +242,7 @@ cd terraform - Next initilize the terraform configuration ```bash -terraform init +terraform init --backend-config=backend.tfvars ``` - Then generate and run an execution plan diff --git a/terraform/backend.tf b/terraform/backend.tf index 84c8d63..b1bfb95 100644 --- a/terraform/backend.tf +++ b/terraform/backend.tf @@ -1,9 +1,4 @@ terraform { backend "s3" { - bucket = "hfla-ops-terraform-state" - key = "devops-security/terraform.tfstate" - region = "us-west-2" - dynamodb_table = "hfla_ops_terraform_table" - encrypt = true } -} +} \ No newline at end of file diff --git a/terraform/prod.backend.tfvars b/terraform/prod.backend.tfvars new file mode 100644 index 0000000..995edf6 --- /dev/null +++ b/terraform/prod.backend.tfvars @@ -0,0 +1,5 @@ +bucket = "hfla-ops-terraform-state" +key = "devops-security/terraform.tfstate" +region = "us-west-2" +dynamodb_table = "hfla_ops_terraform_table" +encrypt = true \ No newline at end of file