v0.9.0
Add `settings` and `env` sections. Use latest `terraform-provider-utils` @aknysh (#12)
what
- Add
settings
andenv
sections - Use latest
terraform-provider-utils
why
settings
sections are deep-merged and used for consumption by external services (e.g. for Spacelift and Terraform Cloud Terraform modules)env
sections are deep-merged and used to specify ENV vars for consumption by external services (e.g. for Spacelift and Terraform Cloud)- Workaround for a deep-merge bug in
mergo.Merge()
. When deep-merging slice of maps in afor
loop,
mergo
modifies the source of the previous loop iteration if it's a complex map andmergo
gets a pointer to it,
not only the destination of the current loop iteration - Much faster
remote-state
for Terraform components (at nativeGo
compiled-binary speed)
references
test
Given this config:
terraform:
vars: {}
settings:
spacelift:
workspace_enabled: false
autodeploy: false
env:
ENV_TEST_1: test1
ENV_TEST_2: test2
ENV_TEST_3: test3
aurora-postgres:
vars:
instance_type: db.r4.large
cluster_size: 1
env:
ENV_TEST_4: test4
ENV_TEST_5: test5
ENV_TEST_6: test6
ENV_TEST_7: test7
aurora-postgres-2:
component: aurora-postgres
vars:
instance_type: db.r4.xlarge
settings:
spacelift:
workspace_enabled: true
autodeploy: true
branch: "dev"
triggers: []
env:
ENV_TEST_1: test1_override2
ENV_TEST_2: test2_override2
ENV_TEST_8: test8
eks:
vars:
spotinst_instance_profile: eg-gbl-dev-spotinst-worker
spotinst_oceans:
main:
desired_group_size: 1
max_group_size: 3
min_group_size: 1
kubernetes_version: null
ami_release_version: null
attributes: null
disk_size: 100
instance_types: null
ami_type: "AL2_x86_64"
tags: null
settings:
spacelift:
workspace_enabled: true
autodeploy: true
branch: "test"
triggers: []
env:
ENV_TEST_1: test1_override
ENV_TEST_2: test2_override
ENV_TEST_4: test4
it produces the following outputs:
uw2_uat_aurora_postgres_2_settings = {
"spacelift" = {
"autodeploy" = true
"branch" = "dev"
"triggers" = []
"workspace_enabled" = true
}
}
uw2_dev_aurora_postgres_2_env = {
"ENV_TEST_1" = "test1_override2"
"ENV_TEST_2" = "test2_override2"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
"ENV_TEST_5" = "test5"
"ENV_TEST_6" = "test6"
"ENV_TEST_7" = "test7"
"ENV_TEST_8" = "test8"
}
uw2_uat_aurora_postgres_settings = {
"spacelift" = {
"autodeploy" = false
"workspace_enabled" = false
}
}
uw2_dev_aurora_postgres_env = {
"ENV_TEST_1" = "test1"
"ENV_TEST_2" = "test2"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
"ENV_TEST_5" = "test5"
"ENV_TEST_6" = "test6"
"ENV_TEST_7" = "test7"
}
uw2_uat_eks_settings = {
"spacelift" = {
"autodeploy" = false
"branch" = "test"
"triggers" = []
"workspace_enabled" = true
}
}
uw2_dev_eks_env = {
"ENV_TEST_1" = "test1_override"
"ENV_TEST_2" = "test2_override"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
}