aws:aws-cloudformation-terraformstate
Differences
This shows you the differences between two versions of the page.
| aws:aws-cloudformation-terraformstate [23/01/2024 16:22] – created - external edit 127.0.0.1 | aws:aws-cloudformation-terraformstate [30/05/2025 09:41] (current) – removed andrew | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Cloudformation for Terraform State Files and Lock Table ====== | ||
| - | |||
| - | Terraform requires a state bucket and lock table before it can do any work, but you can't create these in Terraform because it needs them to do anything.... vicious circle. | ||
| - | |||
| - | I've used Cloud Formation to create these, then Terraform will work as expected. | ||
| - | |||
| - | |||
| - | Terraform_StateS3_and_Dynamo_Lock_Table.yaml | ||
| - | |||
| - | <code yaml> | ||
| - | AWSTemplateFormatVersion: | ||
| - | Description: | ||
| - | |||
| - | Resources: | ||
| - | S3Bucket: | ||
| - | DeletionPolicy: | ||
| - | Type: ' | ||
| - | Description: | ||
| - | Properties: | ||
| - | BucketName: vpc-ec2-statefiles-sg | ||
| - | AccessControl: | ||
| - | PublicAccessBlockConfiguration: | ||
| - | BlockPublicAcls: | ||
| - | BlockPublicPolicy: | ||
| - | IgnorePublicAcls: | ||
| - | RestrictPublicBuckets: | ||
| - | VersioningConfiguration: | ||
| - | Status: Enabled | ||
| - | |||
| - | BucketNameParamater: | ||
| - | Type: AWS:: | ||
| - | Properties: | ||
| - | Description: | ||
| - | Name: TerraformStateBucket-SG | ||
| - | Type: String | ||
| - | Value: !Ref S3Bucket | ||
| - | |||
| - | |||
| - | DynamoLockTable: | ||
| - | Type: AWS:: | ||
| - | Properties: | ||
| - | TableName: vpc-ec2-lockfiles-SG | ||
| - | BillingMode: | ||
| - | AttributeDefinitions: | ||
| - | - | ||
| - | AttributeName: | ||
| - | AttributeType: | ||
| - | |||
| - | KeySchema: | ||
| - | - | ||
| - | AttributeName: | ||
| - | KeyType: HASH | ||
| - | |||
| - | LockTableParameter: | ||
| - | Type: AWS:: | ||
| - | Properties: | ||
| - | Description: | ||
| - | Name: TerraformLockTable-SG | ||
| - | Type: String | ||
| - | Value: !Ref DynamoLockTable | ||
| - | |||
| - | |||
| - | Outputs: | ||
| - | S3Bucket: | ||
| - | Description: | ||
| - | Value: !Ref S3Bucket | ||
| - | |||
| - | DynamoLocktable: | ||
| - | Description: | ||
| - | Value: !Ref DynamoLockTable | ||
| - | </ | ||
aws/aws-cloudformation-terraformstate.1706026943.txt.gz · Last modified: by 127.0.0.1
