Skip to content

Commit 87211ca

Browse files
committed
[NDR-108] readding dynamo-db
1 parent 74d2a27 commit 87211ca

File tree

4 files changed

+48
-35
lines changed

4 files changed

+48
-35
lines changed

.github/workflows/terraform-deploy-feature-to-sandbox.yml

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
environment: ${{ github.event.inputs.environment }}
3030

3131
steps:
32-
- name: Checkout Base
33-
uses: actions/checkout@v4
34-
with:
35-
ref: main
32+
# - name: Checkout Base
33+
# uses: actions/checkout@v4
34+
# with:
35+
# ref: main
3636

3737
- name: Configure AWS Credentials
3838
uses: aws-actions/configure-aws-credentials@v4
@@ -52,29 +52,25 @@ jobs:
5252
terraform_version: 1.11.4
5353
terraform_wrapper: false
5454

55-
- name: Terraform Init Base
56-
id: base_init
57-
run: terraform init -backend-config=backend.conf
58-
working-directory: ./infrastructure
59-
shell: bash
60-
61-
- name: Terraform Set Workspace Base
62-
id: base_workspace
63-
run: terraform workspace select -or-create ${{ github.event.inputs.sandboxWorkspace}}
64-
working-directory: ./infrastructure
65-
shell: bash
66-
67-
- name: Terraform Plan Base
68-
id: base_plan
69-
run: |
70-
terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf-base.plan
71-
working-directory: ./infrastructure
72-
shell: bash
73-
74-
- name: Terraform Apply Base
75-
run: terraform apply -auto-approve -input=false tf-base.plan
76-
working-directory: ./infrastructure
77-
55+
# - name: Terraform Init Base
56+
# id: base_init
57+
# run: terraform init -backend-config=backend.conf
58+
# working-directory: ./infrastructure
59+
# shell: bash
60+
# - name: Terraform Set Workspace Base
61+
# id: base_workspace
62+
# run: terraform workspace select -or-create ${{ github.event.inputs.sandboxWorkspace}}
63+
# working-directory: ./infrastructure
64+
# shell: bash
65+
# - name: Terraform Plan Base
66+
# id: base_plan
67+
# run: |
68+
# terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf-base.plan
69+
# working-directory: ./infrastructure
70+
# shell: bash
71+
# - name: Terraform Apply Base
72+
# run: terraform apply -auto-approve -input=false tf-base.plan
73+
# working-directory: ./infrastructure
7874
- name: Checkout Branch
7975
uses: actions/checkout@v4
8076
with:

backup-vault/teraform/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ terraform {
66
}
77
}
88
backend "s3" {
9-
use_lockfile = true
10-
region = "eu-west-2"
11-
key = "ndr/terraform.tfstate"
12-
encrypt = true
9+
use_lockfile = true
10+
dynamodb_table = "ndr-backup-terraform-lock"
11+
region = "eu-west-2"
12+
key = "ndr/terraform.tfstate"
13+
encrypt = true
1314
}
1415
}
1516
provider "aws" {

bootstrap/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ resource "aws_s3_bucket_public_access_block" "public_access_block" {
6868

6969
data "aws_caller_identity" "current" {}
7070

71+
resource "aws_dynamodb_table" "dynamodb_terraform_state_lock" {
72+
name = "ndr-terraform-locks"
73+
hash_key = "LockID"
74+
read_capacity = 20
75+
write_capacity = 20
76+
77+
attribute {
78+
name = "LockID"
79+
type = "S"
80+
}
81+
lifecycle {
82+
prevent_destroy = true
83+
}
84+
}
85+
7186
variable "region" {
7287
type = string
7388
default = "eu-west-2"

infrastructure/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ terraform {
1212
}
1313
}
1414
backend "s3" {
15-
use_lockfile = true
16-
region = "eu-west-2"
17-
key = "ndr/terraform.tfstate"
18-
encrypt = true
15+
use_lockfile = true
16+
dynamodb_table = "ndr-terraform-locks"
17+
region = "eu-west-2"
18+
key = "ndr/terraform.tfstate"
19+
encrypt = true
1920
}
2021
}
2122
provider "aws" {

0 commit comments

Comments
 (0)