This project provides a CDK construct bootstrapping an AWS account with a S3 Bucket and a DynamoDB table as terraform state backend.
Project description
AWS CDK Terraform state backend
This project provides a CDK construct bootstrapping an AWS account with a S3 Bucket and a DynamoDB table as Terraform state backend.
Terraform doesn't come shipped with a cli command bootstrapping the account for State Storage and Locking
like AWS CDK provides with cdk bootstrap
.
While bootstrapping the AWS Organization and Accounts this construct may be used to create:
- S3 Bucket with blocked public access, versioned, encrypted by SSE-KMS
- DynamoDB Table with pay per request, continuous backups using point-in-time recovery, encrypted by AWS owned key
Example
# Example automatically generated from non-compiling source. May contain errors.
from aws_cdk.core import Environment
from aws_cdk.core import App, Stack
from pepperize.cdk_terraform_state_backend import TerraformStateBackend
app = App()
stack = Stack(app, "stack",
env=Environment(
account="123456789012",
region="us-east-1"
)
)
# When
TerraformStateBackend(stack, "TerraformStateBackend",
bucket_name="terraform-state-backend",
table_name="terraform-state-backend"
)
terraform {
backend "s3" {
bucket = "terraform-state-backend-123456789012-us-east-1"
dynamodb_table = "terraform-state-backend-123456789012"
key = "path/to/my/key"
region = "us-east-1"
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pepperize.cdk-terraform-state-backend-0.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1a12a93944a7b1e483db6ca35b24cbea5e9c2074fec299e24bd3a8d2e212b7e |
|
MD5 | 1755bd3223cd35260688985671f40f9a |
|
BLAKE2b-256 | 0cf927a146c80f03f0f618ae190f3c6bdcb1545894b11a16543b8554d8324205 |
Close
Hashes for pepperize.cdk_terraform_state_backend-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc88d29941367bc8409ef4d556c1b7f40a4f0aca94a72d365c4299fb0df91b6 |
|
MD5 | 68e3ef088473adc5066a3d5f80aa9763 |
|
BLAKE2b-256 | e6a5fa31b127724c1be7d52a4c28b953ed111337e92576ecb4a76cf3cc5c8e3d |