Blueprint Configuration
The primary configuration construct for the Terraform blueprints is the autocloud_blueprint_config data resource. Inspired by the AWS provider's aws_iam_policy_document data resource, the blueprint configuration is a composable data resource that allows the user to determine the display elements the consumer is shown, define static and conditional values to include in the generated code, and define connections between modules. These autocloud_blueprint_config data resources are linked together, and ultimately passed to the autocloud_blueprint resource to define the blueprint the consumer sees in the catalog.
Every autocloud_module resource creates a blueprint configuration that includes all of the variables in the module. It is possible to pass such a configuration directly to a blueprint and publish a single module blueprint to be deployed. However, much of the power of the Terraform blueprints feature comes from the ability to link modules together, reduce the amount of information a consumer needs to input, enhance display information to improve the consumers understanding of what they are being asked to provide, and place guard rails and conditions on the values collected. The arguments the autocloud_blueprint_config supports enable these blueprint capabilities.
The resource supports three arguments:
Argument | Description | Required |
source | A map of blueprint configs to modify/override | No |
omit_variables | An array of variable names to omit from the configuration | No |
variable | An argument block defining a variable in the configuration | No |
Additionally, the resource supports two attributes:
Attribute | Description |
blueprint_config | The blueprint configuration resulting from combining the sources and applying the variable transformations declared in the data resource, used as a source value for other blueprint configs to build from. |
config | The final configuraiton expected by the autocloud_blueprint resource |
For the sake of clarity in discussion using examples, suppose there is a module in the public registry named context that has the following variables defined in variables.tf:
Also suppose that an autocloud_module resource has also been defined:
The source argument allows autocloud_blueprint_config data resources to be built from one another using composition. It is not required, and omitting it will create a blueprint from scratch with the declared variables. By passing blueprint configurations to the source argument, the autocloud_blueprint_config may consolidate, omit, add, or modify variable definitions for one or more existing blueprint configurations.
Example creating a blueprint from scratch with two variables, application, and environment:
Example modifying an existing blueprint config, adding a static owner variable:
The omit_variables argument allows variables to be removed from the blueprint configuration. This is desirable in a number of circumstances, such as when using the default values in the generated terraform code is acceptable, and the consumer does not need to provide a value for the given variable. Another use case is to define a static value for the variable that is always used in the generated code. The omit_variables is an array of strings containing variable names.
If a variable specified in the omit_variables argument exists in multiple configurations, all variables with the matching name will be removed. If the variable name is prefixed with the reference defined in the source argument, only that config's variable will be removed.
Example removing all environment variables from the blueprint configuration:
Example removing the environment variable from just the context module configuration:
The variable argument block defines how variable values should be defined, displayed, collected, and passed to the generated code. See the Variable Definitionsο»Ώ section for detailed coverage of this argument block.
