Created
May 5, 2022 12:24
-
-
Save soerenmartius/d65d4cf323bf4d4b7369c7961c08ac98 to your computer and use it in GitHub Desktop.
This example shows some advanced features of Terramate.
This file contains hidden or 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: stacks/config.tm | |
globals { | |
# define a bucket name that is used when generating backend.tf defined below | |
gcs_bucket_name = "my-state-bucket" | |
# the following will calculate the path name of each stack | |
# but remove the / prefix as gcs does not handle this well | |
gcs_bucket_prefix = tm_substr(terramate.path, 1, -1) | |
} | |
# The block label specifies the name of the file to create in stacks | |
# This file will be generated in all stacks reachable from this configuration | |
generate_hcl "backend.tf" { | |
content { | |
terraform { | |
backend "gcs" { | |
bucket = global.gcs_bucket_name | |
prefix = global.gcs_bucket_prefix | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment