You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-28Lines changed: 19 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,13 @@ Terraform scaffold consists of a terraform wrapper bash script, a bootstrap scri
8
8
9
9
| Thing | Things about the Thing |
10
10
|-------|------------------------|
11
-
| bin/terraform.sh | The master terraform wrapper script |
12
-
| bootstrap/bootstrap.sh| The S3 bucket bootstrapping script|
11
+
| bin/terraform.sh | The terraformscaffold script |
12
+
| bootstrap/ | The bootstrap terraform code used for creating the terraformscaffold S3 bucket|
13
13
| components/ | The location for terraform "components". Terraform code intended to be run directly as a root module. |
14
14
| etc/ | The location for environment-specific terraform variables files:<br/>`env_{region}_{environment}.tfvars`<br/>`versions_{region}_{environment}.tfvars`|
15
15
| lib/ | Optional useful libraries, such as Jenkins pipeline groovy script |
16
16
| modules/ | The optional location for terraform modules called by components |
17
+
| src/ | The optional location for source files, e.g. source for lambda functions zipped up into artefacts inside components |
17
18
18
19
## Concepts & Assumptions
19
20
@@ -63,48 +64,38 @@ On invocation, Scaffold checks for a file at _s3://${bucket}/${project}/secrets/
63
64
64
65
## Usage
65
66
### Bootstrapping
66
-
Before using Scaffold, a bootstrapping stage is required. Scaffold is responsible for creating and maintaining the S3 buckets it uses to store component state files and even keeps the state file that defines the scaffold bucket in the same bucket. This is done with a script specifically designed to run a basic apply of the bootstrap code to create the bucket, and then configures the created bucket as a remote state location for itself. Once the bucket has been created, it can then be used for any terraform apply for the specific combination of project, region and AWS account.
67
+
Before using Scaffold, a bootstrapping stage is required. Scaffold is responsible for creating and maintaining the S3 buckets it uses to store component state files and even keeps the state file that defines the scaffold bucket in the same bucket. This is done with a special bootstrap mode within the script, invoked with the '--bootstrap' parameter. When used with the "apply" action, this will cause the script to create a bootstrap bucket and then configure the bucket as a remote state location for itself. nd upload the tfstate used for managing the bucket to the bucket. Once created, the bucket can then be used for any terraform apply for the specific combination of project, region and AWS account.
67
68
68
-
It is not recommended to modify the bootstrap code after creation as direct application of modified bootstrap code risks the integrity of the state files stored in the bucket; however this can be mitigated by configuring synchronisation with a master backup bucket external to Scaffold management.
69
+
It is not recommended to modify the bootstrap code after creation as it risks the integrity of the state files stored in the bucket that manage other deployments; however this can be mitigated by configuring synchronisation with a master backup bucket external to Scaffold management.
69
70
70
-
The bootstrap script lives at bootstrap/bootstrap.sh and its usage as of 25/01/2017 is:
71
+
Bootstrapping usage:
72
+
73
+
```bash
74
+
bin/bootstrap.sh \
75
+
-p/--project `project` \
76
+
-b/--bucket-prefix `bucket_prefix` \
77
+
-r/--region `region` \
78
+
--bootstrap \
79
+
-a/--action plan
80
+
```
71
81
72
82
```bash
73
83
bootstrap/bootstrap.sh \
74
84
-p/--project `project` \
75
85
-b/--bucket-prefix `bucket_prefix` \
76
-
-r/--region `region`
86
+
-r/--region `region` \
87
+
--bootstrap \
88
+
-a/--action apply
77
89
```
78
90
79
91
Where:
80
92
*`project`: the name of the project to have a terraform bootstrap applied
81
93
*`bucket_prefix` (optional - use only with caution): Defaults to: `${project}-terraformscaffold"`
82
94
*`region` (optional): Defaults to value of the AWS_DEFAULT_REGION environment variable
83
95
84
-
Aside from the parameter management and other simple bash constructs, the bootstrapping process in the script is three basic steps:
On the to-do list for future development is to make the bootstrap script check for the presence of an existing bucket and state file, and - if found - to configure it as the remote state prior to application. The current implementation assumes that you will only run bootstrap once, or if you run it a second time, you know what you are doing and have prepared the presence of the state file if it is not still present from the initial run.
104
-
105
96
### Running
106
97
107
-
The main scaffold invocation script is bin/terraform.sh. Once a state bucket has been bootstrapped, bin/terraform.sh can be run to apply terraform code. Its usage as of 25/01/2017 is:
98
+
The terraformscaffold script is invoked as bin/terraform.sh. Once a state bucket has been bootstrapped, bin/terraform.sh can be run to apply terraform code. Its usage as of 25/01/2017 is:
0 commit comments