Use this to prep a new environment to be managed by our tooling stack.
For the examples below, we'll say we're creating the environment easta
basing it on the environment westa
(NOTE: your environment name should not end in a number)
- First, copy
scripts/add_environment/env.example.sh
toscripts/add_environment/env.sh
(env.sh
is in the gitignore, so really do this - credential leak fire drills are no fun) - Second, fetch the arn of the concourse iaas workers from the tooling account and put it for
TF_VAR_tf_remote_role_arn
in theenv.sh
file - Third, fetch the arn of user for iam cert provisioner and put in for
TF_VAR_cert_remote_role_arn
in theenv.sh
file.
- Generate key with
ssh-keygen -f <env> -C <env>
- Put both files into varz bucket under
/keys/
folder
source scripts/add_environment/env.sh
- Run
scripts/add_environment/manage_environment.sh
from the root of this repository - From the output json file, get the
tf_role_arn
andcert_role_arn
- Get the cg-provision.yml file from s3
- Add these values to the file
<env>_assume_arn: <TF ROLE ARN from terraform output>
<env>_parent_assume_arn: <TF REMOTE ROLE ARN from `TF_VAR_tf_remote_role_arn` in env.sh>
<env>_parent_stack_name: tooling
<env>_ssh_key: <value from key.pub>
ci/pipeline.yml
duplicate theplan-bootstrap-westa
,bootstrap-westa
,acme-certificate-westa
, andacme-certificate-westa
jobs toplan-bootstrap-easta
,bootstrap-easta
,acme-certificate-easta
, andacme-certificate-easta
, respectively- in the new jobs, edit the names of any variables, tasks, etc to refer to the new environment
TF_VAR_assume_arn: ((<env>_assume_arn))
TF_VAR_parent_assume_arn: ((<env>_parent_assume_arn))
TF_VAR_parent_stack_name: ((<env>_parent_stack_name))
TF_VAR_bosh_default_ssh_public_key: ((<env>_ssh_key))
- get the cg-provision secrets file from the secrets s3 bucket
- generate new values for all of these. For secrets, such as passwords, use a cryptographic string generator. For othe values, try to follow estabilished patterns.
- for
ASSUME_ROLE_ARN
inacme-certificate-easta
andacme-certificate-east-1-apps
(twice in each job), use the value fromcert_role_arn
above - fly the pipeline:
fly -t concourse set-pipeline -p terraform-provision -c ./ci/pipeline.yml -l <path-to-secrets-file>
- run
acme-certificate-easta
in concourse - run
acme-certificate-easta-apps
in concourse - run
plan-bootstrap-easta
in concourse - review the plan. Sorry.
- assuming it looks good, run
bootstrap-easta
in concourse
TODO: same thing for external environments