fix(0-bootstrap): declare billing_override, fix the assured_workload output, align the prefix limit - #213
Open
scottonix wants to merge 1 commit into
Open
Conversation
…output, align the prefix limit Three small consistency fixes in the bootstrap stage: - templates/providers.tf.tpl renders four references to var.billing_override into every generated providers file, including 0-bootstrap-providers.tf, but stage 0 never declared the variable (stages 1, 2 and 3 do). Terraform only rejects the reference once a resource uses the google.billing alias, so the stage works today by accident; declare the variable with the same shape and default as the other stages so the generated file is self-consistent. - output assured_workload wrapped module.no-compliance-folder[0].folder.id in "folders/" although google_folder.id already carries that prefix, producing "folders/folders/NNN" whenever assured_workloads.regime is COMPLIANCE_REGIME_UNSPECIFIED. organization.tf uses the bare id for the same folder; the output now uses the module's fully qualified id. - var.prefix is validated to 7 characters or fewer, but its description, the tfvars sample and the README all said 9. The validation is the behaviour; the text now matches it. Signed-off-by: Scott McDonald <scott.mcdonald@onixnet.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three small consistency fixes in
fast/stages-aw/0-bootstrap, each found while deploying the stage:billing_overrideis referenced but never declared.templates/providers.tf.tplrenders four references tovar.billing_overrideinto every generated providers file, including0-bootstrap-providers.tf, but stage 0 has novariable "billing_override"(stages 1, 2 and 3 declare it). Terraform only rejects the reference once a resource uses thegoogle.billingalias, so the stage works today by accident; the moment anyone adds a resource on that alias in stage 0,init/planfail withReference to undeclared input variable. Declare the variable with the same shape and default as the other stages.output "assured_workload"producedfolders/folders/NNNwhenassured_workloads.regimeisCOMPLIANCE_REGIME_UNSPECIFIED: it wrappedmodule.no-compliance-folder[0].folder.idin"folders/", butgoogle_folder.idalready carries that prefix.organization.tfuses the bare id for the same folder (the Common Services folder's parent). The output now uses the folder module's fully qualifiedid.var.prefixis validated tolength <= 7, while its description,terraform.tfvars.sampleand the README all told the user 9 characters or fewer; a prefix of 8 or 9 characters fails on the first plan. The validation is the behaviour (main.tfbuilds<prefix>-prodfrom it), so the text now matches it.Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/can be leveraged for this change.documentation/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
Terraform 1.10.5.
terraform validateon0-bootstrappasses with the change.google.billingalias provider block containstry(var.billing_override.project, "x")validates and plans while no resource uses the alias, and fails withReference to undeclared input variableon all four references as soon as one does. Stage 0 currently has no resource on that alias, which is why the rendered0-bootstrap-providers.tfhas not broken anyone yet.terraform output assured_workloadreturnedfolders/folders/<id>; the generated0-bootstrap.auto.tfvars.jsonthat stage 1 consumes was correct, because it is built fromorganization.tf's bare id.