This website requires JavaScript.
Explore
Help
Sign In
ResiLien
/
terraform
Watch
2
Star
0
Fork
You've already forked terraform
0
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
4ecf569aea
terraform
/
configs
/
test-fixtures
/
valid-modules
/
override-module
/
a_override.tf
8 lines
108 B
Terraform
Raw
Normal View
History
Unescape
Escape
configs: allow overrides files to omit args that primary files can't Some of the fields in our config structs are either mandatory in primary files or there is a default value that we apply if absent. Unfortunately override files impose the additional constraint that we be allowed to omit required fields (which have presumably already been set in the primary files) and that we are able to distinguish between a default value and omitting a value entirely. Since most of our fields were already acceptable for override files, here we just add some new fields to deal with the few cases where special handling is required and a helper function to disable the "Required" flag on attributes in a given schema.
2018-02-07 03:05:14 +01:00
module
"
example
"
{
configs: Implementation of mergeBody mergeBody is a hcl.Body implementation that deals with our override file merging behavior for the portions of the configuration that are not processed until full eval time. Mimicking the behavior of our old config merge implementation from the "config" package, the rules here are: - Attributes in the override body hide attributes of the same name in the base body. - Any block in the override body hides all blocks with the same type name that appear in the base body. This is tested by a new test for the overriding of module arguments, which asserts the correct behavior of the merged body as part of its work.
2018-02-07 03:30:12 +01:00
source
=
"
./example2-a_override
"
configs: allow overrides files to omit args that primary files can't Some of the fields in our config structs are either mandatory in primary files or there is a default value that we apply if absent. Unfortunately override files impose the additional constraint that we be allowed to omit required fields (which have presumably already been set in the primary files) and that we are able to distinguish between a default value and omitting a value entirely. Since most of our fields were already acceptable for override files, here we just add some new fields to deal with the few cases where special handling is required and a helper function to disable the "Required" flag on attributes in a given schema.
2018-02-07 03:05:14 +01:00
foo
=
"
a_override foo
"
new
=
"
a_override new
"
}