This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
bootstrap.yml
60 lines (55 loc) · 1.75 KB
/
bootstrap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
#############################################################################
# Bootstrap
#############################################################################
# This template provides base resources for a Terraform stack to store and
# manage remote state.
#############################################################################
AWSTemplateFormatVersion: "2010-09-09"
Description: "Terraform bootstrap"
# Custom parameters
Parameters:
ServiceName:
Description: Base name of the service
Type: String
# Our arbitrary choices for supported, isolated statges.
Stage:
Description: Operational stage (e.g., development, staging, production)
Type: String
Resources:
# Enable Terraform state in AWS
# https://www.terraform.io/docs/backends/types/s3.html
TerraformState:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "cf-${ServiceName}-${Stage}-terraform-state"
# > It is highly recommended that you enable Bucket Versioning on the S3
# > bucket to allow for state recovery in the case of accidental deletions
# > and human error.
VersioningConfiguration:
Status: Enabled
Tags:
-
Key: "Service"
Value: !Sub "${ServiceName}"
-
Key: "Stage"
Value: !Sub "${Stage}"
TerraformLocks:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Sub "cf-${ServiceName}-${Stage}-terraform-locks"
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: LockID
KeyType: HASH
AttributeDefinitions:
- AttributeName: LockID
AttributeType: S
Tags:
-
Key: "Service"
Value: !Sub "${ServiceName}"
-
Key: "Stage"
Value: !Sub "${Stage}"