Commit Graph

141 Commits

Author SHA1 Message Date
Martin Atkins
22633a280d website: Optional object attributes handling of null
Previously we didn't describe the interaction between default values and
callers explicitly passing "null".

We treat an explicit null as the same as omitting the attribute when
applying defaults, because that then allows callers to use the typical
pattern for conditional assignment, using explicit null as a fallback
to the module's defined default without having to duplicate that default:
    example = var.foo ? "hello" : null
2022-08-15 14:45:06 -07:00
Bob Sutterfield
9ca771c990 Update website/docs/language/expressions/type-constraints.mdx
Co-authored-by: Matthew Garrell <69917312+mgarrell777@users.noreply.github.com>
2022-08-09 09:46:16 -07:00
Bob Sutterfield
4afba76f4a Update website/docs/language/expressions/type-constraints.mdx
Co-authored-by: Matthew Garrell <69917312+mgarrell777@users.noreply.github.com>
2022-08-09 09:45:40 -07:00
Bob Sutterfield
08f3f675eb insert missing infinitive particle 2022-08-08 17:17:50 -07:00
Laura Pacilio
f6aeecb592 Update website/docs/language/expressions/references.mdx 2022-07-29 16:52:58 -04:00
Laura Pacilio
e574234efc Add note about module.path and local module sources 2022-07-29 15:24:04 -04:00
Zhuoyun Wei
7427aa1805 Rephrase the paragraph as suggested 2022-07-27 21:31:46 -07:00
Zhuoyun Wei
a83e76125b docs: fix typo regarding unknown values 2022-07-25 12:16:31 -07:00
Alisdair McDiarmid
8db2552b5f Remove experiment from optional attrs example 2022-06-17 11:38:12 -04:00
Ryan Uber
52d54b0a64 Update wording for 'path.cwd' to be explicit about implications 2022-06-08 14:02:51 -07:00
Laura Pacilio
29435b46ac Edit type constraints docs for style and flow 2022-06-08 12:40:29 -04:00
Laura Pacilio
6aa960c239 Update website/docs/language/expressions/custom-conditions.mdx 2022-06-07 17:09:42 -04:00
Laura Pacilio
9b57fc2964 Add guidance about using the format function 2022-06-07 16:44:25 -04:00
Alisdair McDiarmid
f8e2b3ada5 Merge pull request #31154 from hashicorp/alisdair/module-variable-optional-default
Add inline defaults to optional object attribute type constraints
2022-06-06 11:06:43 -04:00
Adam Christie
50919044d5 Fix custom conditions example
Original code block erroneously references `aws_vpc.example` but appears to actually mean `data.aws_vpc.example`.
2022-06-01 12:41:15 +01:00
Alisdair McDiarmid
e2a3042025 website: Update documentation for optional attrs
Extend the documentation on type constraints to include the new default
functionality, including a detailed example of a nested structure with
multiple levels of defaults.
2022-06-01 06:40:37 -04:00
Laura Pacilio
83a700b313 Update version notes for custom conditions 2022-05-20 16:10:26 -04:00
Laura Pacilio
b2d3e594ca Remove duplicate versioning note for custom condition checks. 2022-05-20 16:07:27 -04:00
Laura Pacilio
54d084159f Add version note, fix typos, add link to environment variables 2022-05-20 16:00:53 -04:00
Laura Pacilio
179e108cd1 Update website/docs/language/expressions/custom-conditions.mdx 2022-05-18 13:49:44 -04:00
Laura Pacilio
edf9324a9e Add learn tutorial link 2022-05-18 12:22:32 -04:00
Laura Pacilio
35bc9943ec Merge pull request #31012 from StefanSchoof/patch-1
Use different names for var and block
2022-05-18 10:45:37 -04:00
StefanSchoof
650ada19b7 change also variable name in text 2022-05-18 07:59:47 +02:00
Laura Pacilio
1666aa8463 Update website/docs/language/expressions/custom-conditions.mdx
Co-authored-by: Robin Norwood <rnorwood@hashicorp.com>
2022-05-16 16:43:15 -04:00
Laura Pacilio
5841db00b3 Change private to public dns :-) 2022-05-16 16:28:15 -04:00
Martin Atkins
289bb60ce1 core: Defer on transitive dependencies for data resources with conditions
When a data resource is used for the purposes of verifying a condition
about an object managed elsewhere (e.g. if the managed resource doesn't
directly export all of the information required for the condition) it's
important that we defer the data resource read to the apply step if the
corresponding managed resource has any changes pending.

Typically we'd expect that to come "for free" but unfortunately we have
a pragmatic special case in our handling of data resources where we
normally defer to the apply step only if a _direct_ dependency of the data
resource has a change pending, and allow a plan-time read if there's
a pending change in an indirect dependency. This allowed us to preserve
some compatibility with the questionable historical behavior of always
reading data resources proactively unless the configuration contains
unknown values, since the arguably-more-correct behavior would've been a
regression for anyone who had been depending on that before.

Since preconditions and postconditions didn't exist until now, we are not
constrained in the same way by backward compatibility, and so we can adopt
the more correct behavior in the case where a data resource has conditions
specified. This does unfortunately make the handling of data resources
with conditions subtly inconsistent with those that don't, but this is
a better situation than the alternative where it would be easy to get into
a trapped situation where the remote system is invalid and it's impossible
to plan the change that would make it valid again because the conditions
evaluate too soon, prior to the fix being applied.
2022-05-11 11:01:38 -07:00
StefanSchoof
7cb1cf7b63 Use different names for var and block
I think it is easier to understand, which refers to the var and which to the block, when the var has not the exact same name as the block
2022-05-06 09:47:03 +02:00
Alisdair McDiarmid
b0f837e1f3 Fix custom conditions Markdown typo 2022-05-05 18:38:29 -04:00
Laura Pacilio
b1d9339368 Final formatting nits 2022-04-20 12:19:29 -04:00
Laura Pacilio
3c7c5bbd21 add links to function and expressions; move result types back to conditionals page (oops) 2022-04-20 12:06:50 -04:00
Laura Pacilio
2a206c7984 fix incorrect HCL syntax for example 2022-04-20 11:49:33 -04:00
Laura Pacilio
7a43db405c Add link to operators page and all out other types 2022-04-20 11:46:37 -04:00
Laura Pacilio
ba3bb5ad5d Apply suggestions from PR review 2022-04-20 11:30:20 -04:00
Laura Pacilio
f660f54b87 Final nits from review 2022-04-20 11:21:11 -04:00
Laura Pacilio
f9462d5d51 Update links to say "Custom Condition Checks" 2022-04-07 16:25:09 -04:00
Laura Pacilio
3ed8c5c467 Fix in-text link 2022-04-07 13:51:56 -04:00
Laura Pacilio
4c097842df Move conditionals information to conditional expressions page 2022-04-07 13:48:44 -04:00
Laura Pacilio
375b3583fd APply suggestions from PR review 2022-04-07 12:12:13 -04:00
Laura Pacilio
3bc3bc52f8 Update website/docs/language/expressions/custom-conditions.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2022-04-07 11:40:01 -04:00
Laura Pacilio
b997c983a5 Update website/docs/language/expressions/custom-conditions.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2022-04-07 11:39:41 -04:00
Laura Pacilio
4ab955eeab Update website/docs/language/expressions/custom-conditions.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2022-04-07 10:13:41 -04:00
Laura Pacilio
6b986c94bc Update website/docs/language/expressions/custom-conditions.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2022-04-07 10:12:49 -04:00
Laura Pacilio
d69cb58ff5 Add additional sections to condition expressions section 2022-04-06 17:01:04 -04:00
Laura Pacilio
eea860e0cf Fixing typos and doing a read through 2022-04-06 16:55:43 -04:00
Laura Pacilio
5803963be8 more nitpicks 2022-04-06 15:45:27 -04:00
Laura Pacilio
62a7b51ba7 more edits 2022-04-06 15:41:02 -04:00
Laura Pacilio
3ae238a448 More language edits 2022-04-06 14:57:20 -04:00
Laura Pacilio
af7e688859 more language cleanup for clarity 2022-04-05 17:01:21 -04:00
Laura Pacilio
b2576a3df3 Update page name to Custom Conditions per feedback 2022-04-05 15:50:24 -04:00
Laura Pacilio
040985f6e1 more edits 2022-03-30 17:59:03 -04:00