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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5abb41f9a49bb58b5c837bb184109d7baeb575cecef5d3540089a3a4b4cafb9 |
|
MD5 | 2e0ef1bc4088f9bb7ea0cadd483321b4 |
|
BLAKE2b-256 | 4144e348f486611bb56a2a1bc91a6899b7e8bb6041cade94aba3e17f0aedaa02 |
Close
Hashes for pepperize.cdk_terraform_state_backend-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a613aaaa9b0c0ca3f5dddcfece6a227905f3d92ec368e0ee809eacf1e4c1c3c8 |
|
MD5 | b8387314dd781edd735aa0a85ad231e1 |
|
BLAKE2b-256 | ca30cd2f30d3b9f4c166fe0b264cdfd662de6b312c8803df5b64b5453eaa3bc8 |