Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

feat: migrating TF state to S3 #270

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
2 changes: 1 addition & 1 deletion .aws/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.7
1.6.6
11 changes: 6 additions & 5 deletions .aws/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Construct } from 'constructs';
import {
App,
DataTerraformRemoteState,
RemoteBackend,
S3Backend,
TerraformStack,
} from 'cdktf';
import { AwsProvider } from '@cdktf/provider-aws/lib/provider';
Expand Down Expand Up @@ -30,10 +30,11 @@ class BrazeContentProxy extends TerraformStack {
new LocalProvider(this, 'local_provider');
new NullProvider(this, 'null_provider');

new RemoteBackend(this, {
hostname: 'app.terraform.io',
organization: 'Pocket',
workspaces: [{ prefix: `${config.name}-` }],
new S3Backend(this, {
bucket: `mozilla-content-team-${config.environment.toLowerCase()}-terraform-state`,
dynamodbTable: `mozilla-content-team-${config.environment.toLowerCase()}-terraform-state`,
key: config.name,
region: 'us-east-1',
});

const region = new DataAwsRegion(this, 'region');
Expand Down
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ phases:
# synthesize the js into terraform json with the proper node environment
- 'if [ "$GIT_BRANCH" = "$DEV_BRANCH" ]; then NODE_ENV=development npm run synth; else npm run synth; fi'
- cd cdktf.out/stacks/braze-content-proxy
- terraform init
- 'if [ "$GIT_BRANCH" = "$DEV_BRANCH" ]; then TF_WORKSPACE=$TF_DEV_WORKSPACE terraform init; else terraform init; fi'
build:
run-as: circleci
commands:
Expand Down
Loading