Skip to content

Commit

Permalink
chore: Update Terraform backend configuration file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Jul 3, 2024
1 parent 5681f0c commit af6af94
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 56 deletions.
5 changes: 2 additions & 3 deletions live/common-infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

2. **Check the Terraform Backend Configuration:**

Verify that the backend configuration is set correctly in the `backend.tf` file.
Verify that the backend configuration is set correctly in the `configs/prod-backend.tfvars` file.

```hcl
terraform {
Expand All @@ -42,7 +42,6 @@
encrypt = "true"
}
}
```

Replace the placeholder values with the actual bucket name, key, region, and DynamoDB table name.
Expand All @@ -52,7 +51,7 @@
Initialize the working directory with the required providers and modules:

```sh
terraform init
terraform init -backend-config="configs/prod-backend.tfvars"
```

4. **Workspace Management:**
Expand Down
4 changes: 4 additions & 0 deletions live/common-infra/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
terraform {
backend "s3" {
}
}
7 changes: 3 additions & 4 deletions live/core-networking/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Common Infrastructure
# Core Networking Terraform Module

🏢 This directory contains the Terraform configuration for our core cloud infrastructure. It provides a ready-to-use Terraform module with essential services and security features.

Expand Down Expand Up @@ -29,7 +29,7 @@

2. **Check the Terraform Backend Configuration:**

Verify that the backend configuration is set correctly in the `backend.tf` file.
Verify that the backend configuration is set correctly in the `configs/prod-backend.tfvars` file.

```hcl
terraform {
Expand All @@ -44,7 +44,6 @@
encrypt = "true"
}
}
```

Replace the placeholder values with the actual bucket name, key, region, and DynamoDB table name.
Expand All @@ -54,7 +53,7 @@
Initialize the working directory with the required providers and modules:

```sh
terraform init
terraform init -backend-config="configs/prod-backend.tfvars"
```

4. **Workspace Management:**
Expand Down
4 changes: 4 additions & 0 deletions live/core-networking/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
terraform {
backend "s3" {
}
}
2 changes: 1 addition & 1 deletion live/terraform-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Initialize the Terraform working directory which will download the necessary providers and modules:

```sh
terraform init
terraform init -backend-config="./configs/prod-backend.tfvars"
```

2. **Workspace Management:**
Expand Down
25 changes: 3 additions & 22 deletions live/terraform-backend/backend.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# You cannot create a new backend by simply defining this and then
# immediately proceeding to "terraform apply". The S3 backend must
# be bootstrapped according to the simple yet essential procedure in
# https://github.com/cloudposse/terraform-aws-tfstate-backend#usage
module "terraform_state_backend" {
source = "cloudposse/tfstate-backend/aws"
version = "1.1.1"

name = var.name
namespace = var.namespace
environment = var.environment
stage = var.stage
attributes = ["state"]

terraform_backend_config_file_path = "./configs"
terraform_backend_config_file_name = "${var.environment}-backend.tfvars"
terraform_state_file = "${module.label.id}.tfstate"

bucket_enabled = true
dynamodb_enabled = false

force_destroy = false
terraform {
backend "s3" {
}
}
22 changes: 0 additions & 22 deletions live/terraform-backend/core-networking-backend.tf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ module "terraform_state_backend" {
source = "cloudposse/tfstate-backend/aws"
version = "1.1.1"

name = "common-infra"
name = var.name
namespace = var.namespace
environment = var.environment
stage = var.stage
attributes = ["state"]

terraform_backend_config_file_path = "../common-infra"
terraform_backend_config_file_path = "./configs"
terraform_backend_config_file_name = "${var.environment}-backend.tfvars"
terraform_state_file = "${var.namespace}-common-infra-${var.environment}.tfstate"
terraform_state_file = "${module.label.id}.tfstate"

bucket_enabled = true
dynamodb_enabled = true
dynamodb_enabled = false

force_destroy = false
}

0 comments on commit af6af94

Please sign in to comment.