Metadata-Version: 2.1
Name: pepperize.cdk-terraform-state-backend
Version: 0.0.3
Summary: This project provides a CDK construct bootstrapping an AWS account with a S3 Bucket and a DynamoDB table as terraform state backend.
Home-page: https://github.com/patrick.florek/papperize/cdk-terraform-state-backend.git
Author: Patrick Florek<patrick.florek@gmail.com>
License: MIT
Project-URL: Source, https://github.com/patrick.florek/papperize/cdk-terraform-state-backend.git
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aws-cdk.aws-dynamodb (<2.0.0,>=1.134.0)
Requires-Dist: aws-cdk.aws-iam (<2.0.0,>=1.134.0)
Requires-Dist: aws-cdk.aws-s3 (<2.0.0,>=1.134.0)
Requires-Dist: aws-cdk.core (<2.0.0,>=1.134.0)
Requires-Dist: constructs (<4.0.0,>=3.2.27)
Requires-Dist: jsii (<2.0.0,>=1.46.0)
Requires-Dist: publication (>=0.0.3)

[![GitHub](https://img.shields.io/github/license/pepperize/cdk-terraform-state-backend?style=flat-square)](https://github.com/pepperize/cdk-terraform-state-backend/blob/main/LICENSE)
[![npm (scoped)](https://img.shields.io/npm/v/@pepperize/cdk-terraform-state-backend?style=flat-square)](https://www.npmjs.com/package/@pepperize/cdk-terraform-state-backend)
[![PyPI](https://img.shields.io/pypi/v/pepperize.cdk-terraform-state-backend?style=flat-square)](https://pypi.org/project/pepperize.cdk-terraform-state-backend/)
[![Nuget](https://img.shields.io/nuget/v/Pepperize.CDK.TerraformStateBackend?style=flat-square)](https://www.nuget.org/packages/Pepperize.CDK.TerraformStateBackend/)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/pepperize/cdk-terraform-state-backend/release/main?label=release&style=flat-square)](https://github.com/pepperize/cdk-terraform-state-backend/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/pepperize/cdk-terraform-state-backend?sort=semver&style=flat-square)](https://github.com/pepperize/cdk-terraform-state-backend/releases)

# 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](https://www.terraform.io/docs/language/settings/backends/s3.html).

Terraform doesn't come shipped with a cli command bootstrapping the account for [State Storage and Locking](https://www.terraform.io/docs/language/state/backends.html)
like [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/cli.html#cli-bootstrap) 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

```python
# 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"
)
```

```hcl
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"
  }
}
```

See [Terraform S3 Example Configuration](https://www.terraform.io/docs/language/settings/backends/s3.html#example-configuration)


