-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve deployment experience and features (#76)
* Improve deployment experience and features Two features are: 1. Store terraform state in GCS buckets 2. Support multiple deployments for different environments Storing state in GCS buckets provides a canonical location for the current deployment state, which better supports multiple maintainers. Previously, the state was stored on the local developer machine. This made life tedious and error prone for multiple maintainers, or even a single maintainer with multiple machines. Different environments allows us to avoid testing in prod, and to stage releases properly. ci and prod are created for real world usage, and the dev environment is an environment in which we can test out more risky changes that won't be exposed to the outside world. Note that these changes require terragrunt in addition to terraform. This is a small open source tool that provides support for both of these features. It breaks the chicken-and-egg loop of creating GCS buckets using terraform, but needing a GCS bucket in which to store the state. It also easily supports different live environments invoking the same module with input parameters, allowing for clear code reuse while having separate files for each environment. This is the least risky approach I can see to supporting updates to one environment without modifying the others. * Link to install
- Loading branch information
1 parent
f7c27ba
commit 6a4289d
Showing
10 changed files
with
124 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/deployment/.terraform | ||
/deployment/*.tfstate.backup | ||
/deployment/**/.terragrunt-cache | ||
/deployment/**/.terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
terraform { | ||
source = "${get_path_to_repo_root()}/deployment/modules/distributor" | ||
} | ||
|
||
locals { | ||
common_vars = read_terragrunt_config(find_in_parent_folders()) | ||
} | ||
|
||
inputs = merge( | ||
local.common_vars.locals, | ||
{ | ||
docker_tag = "latest" | ||
env = "ci" | ||
} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
terraform { | ||
source = "${get_path_to_repo_root()}/deployment/modules/distributor" | ||
} | ||
|
||
locals { | ||
common_vars = read_terragrunt_config(find_in_parent_folders()) | ||
} | ||
|
||
inputs = merge( | ||
local.common_vars.locals, | ||
{ | ||
docker_tag = "latest" | ||
env = "dev" | ||
} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
terraform { | ||
source = "${get_path_to_repo_root()}/deployment/modules/distributor" | ||
} | ||
|
||
locals { | ||
common_vars = read_terragrunt_config(find_in_parent_folders()) | ||
} | ||
|
||
inputs = merge( | ||
local.common_vars.locals, | ||
{ | ||
docker_tag = "latest" # TODO(mhutchinson): change this to tagged releases | ||
env = "prod" | ||
} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
locals { | ||
project_id = "checkpoint-distributor" | ||
region = "us-central1" | ||
env = path_relative_to_include() | ||
} | ||
|
||
remote_state { | ||
backend = "gcs" | ||
|
||
config = { | ||
project = local.project_id | ||
location = local.region | ||
bucket = "${local.project_id}-${local.env}-terraform-state" | ||
prefix = "${path_relative_to_include()}/terraform.tfstate" | ||
|
||
gcs_bucket_labels = { | ||
name = "terraform_state_storage" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.