Open bra1ncramp opened 2 years ago
add the following variable in variables.tf
- then replace cool
with ${var.cool_realm}
in remote_states.tf
and backend.tf
variable "cool_realm" {
type = string
description = "The realm name for your enviroment. Used to set object names."
default = "cool"
}
example from remote_states.tf
data "terraform_remote_state" "images_parameterstore" {
backend = "s3"
config = {
encrypt = true
bucket = "cisa-${var.cool_realm}-terraform-state"
dynamodb_table = "terraform-state-lock"
profile = "${var.cool_realm}-terraform-backend"
region = "us-east-1"
key = "${var.cool_realm}-images-parameterstore/terraform.tfstate"
}
workspace = terraform.workspace
}
this value can be overwritten in the tfvars
file with cool_realm = "my_realm"
This may not be possible - apparently, we cannot use variables in backend
https://github.com/hashicorp/terraform/issues/13022
💡 Summary
What is the work, as a high-level summary?
Motivation and context
In order to make this project more environment agnostic, it would be good to make references to
cool
variable.This would allow implementers to simply modify their
tfvars
file for variances.Implementation notes
Recommend adding a variable in
variables.tf
that takes thenetbios_name
, and converts to lowercase. Throughout other.tf
files, insert this variable instead of hard-coding 'cool'.netbios_name
then, can be set in the.tfvars
file.key examples where this would be used would be in
remote_states.tf
andbackend.tf
Acceptance criteria
How do we know when this work is done?