Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ TLDR, but really, go read the post, it's way better then what I'm going to write
The Current production [terraform version](https://github.com/FitnessKeeper/terraform-runkeeper#terraform-version) can be found here
### To create a new repo using the terraform-reference repo.

- Clone the repo `git clone https://github.com/FitnessKeeper/terraform-reference`
- Edit .env in the root of the repo, in particular make sure you add a TF_PROJECT_NAME
- Clone the repo into a new directory for your project `git clone https://github.com/FitnessKeeper/terraform-reference terraform-<project name>`
- Edit .env in the root of the repo, in particular make sure you add a TF_PROJECT_NAME (this should be the new name of the repo, `terraform-<project name>`)
- When creating a `spike` make sure you update TF_SPINE in env if something other then `rk` is needed, at the time of this writing `rk` and `asics` are valid spines.
- Also when creating ASICS `spikes` update to `TF_LOCK_TABLE=asics-services-terraformStateLock`
- If needed, set TF_STACK for the `stack` variable
- Initialize variables.tf, this only needs to be done once, when the repo is created run `./init-variables.tf.sh`
- Remove the old origin `git remote rm origin`
- Add your new repo `git remote add origin https://github.com/FitnessKeeper/terraform-reference.git`
- Add your new repo `git remote add origin https://github.com/FitnessKeeper/terraform-<project name>.git`
- Commit your changes
- `git push -u origin master`
- Edit variables.tf to reflect your new service
Expand Down
11 changes: 10 additions & 1 deletion init-variables.tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ echo $TF_PROJECT_NAME

tf_spine="${TF_SPINE:-rk}"

# Set stack if TF_STACK is set; if not, comment out the stack variable entirely
if [[ "${TF_STACK}" ]] ; then
STACK_VAR_COMMENT_OPTIONAL=""
STACK_VAR_DEFAULT="$TF_STACK"
else
STACK_VAR_COMMENT_OPTIONAL="# "
STACK_VAR_DEFAULT="ref"
fi

export VARIABLES_TF=$(cat <<EOF
# Variables.tf declares has the default variables that are shared by all environments
# \$var.region, \$var.domain, \$var.tf_s3_bucket
Expand Down Expand Up @@ -58,7 +67,7 @@ variable "region" { default = "${aws_default_region}" }

# This should be changed to reflect the service / stack defined by this repo
# for example replace "ref" with "cms", "slackbot", etc
variable "stack" { default = "ref" }
${STACK_VAR_COMMENT_OPTIONAL}variable "stack" { default = "${STACK_VAR_DEFAULT}" }

variable "tf_s3_bucket" {
description = "S3 bucket Terraform can use for state"
Expand Down