Resolve and Reveal
PROPLD and DETOKN Extensions
Properties which are mapped to variables can now be directly defined as such. This is particularly useful for values that are only known at deploy time, such as cloud resources which are automatically allocated by the provider or are randomly generated such as UUIDs.
For the following example tokenised settings file, for example variables.tf
variable "terraform_token" { default = "%terraform_token%" }
variable "api_ip" { default = "%api_ip%" }
variable "redis_cache" { default = "%redis_cache%" }
Non-sensitive variable mapping can be applied to the properties.cm definition
context target workspace_space redis_cache api_ip
local dev kot-dev $REDIS_URL 10.240.10.10
local test kot-test $REDIS_URL 10.240.10.11
local prod kot-prod $REDIS_URL 10.240.10.10
While secrets, supplied as environment variables, can be defined in CDAF.solution
artifactPrefix=0.3
solutionName=kot
terraform_token=$ENV:TF_CLOUD_TOKEN
In the deploy task, process non-sensitive variables first. Note: to use the new features, the property file must be explicitely supplied.
DETOKN variables.tf $TARGET reveal
At deploy time non-sensitive nested variables are expanded and displayed
[Transform.ps1] PROPFILE : test
[Transform.ps1] TOKENFILE : variables.tf
Found %workspace_space%, replacing with kot-test
Found %redis_cache%, replacing with redis-system-generated.cloud
Then secrets can be expanded. Note: all contents of CDAF.solution are packaged with build outputs in manifest.txt
DETOKN variables.tf manifest.txt resolve
These are not displayed, the origin variable name is logged for debugging
[Transform.ps1] PROPFILE : manifest.txt
[Transform.ps1] TOKENFILE : variables.tf
Found %terraform_token%, replacing with $ENV:TF_CLOUD_TOKEN
For full release details for CDAF 2.5.1 see http://cdaf.io/release