Commit Graph

23955 Commits

Author SHA1 Message Date
Kristin Laemmert dfcd2fb00c
Update CHANGELOG.md 2019-04-15 12:23:28 -04:00
Kristin Laemmert c1079b59bd
command/state_list.go: fix bug loading user-defined state (#21015)
* command/state_list.go: fix bug loading user-defined state

If the user supplied a state path via the `-state` flag and terraform
was running in a workspace other than `default`, the state was not being
loaded properly. Fixes #19920
2019-04-15 12:22:07 -04:00
Kristin Laemmert 8645b9703c
Update CHANGELOG.md 2019-04-12 14:10:16 -04:00
Kristin Laemmert d4669246c7
funcs/coalesce: return the first non-null, non-empty-string element from a sequence (#21002)
* funcs/coalesce: return the first non-null, non-empty element from a
sequence.

The go-cty coalesce function, which was originally used here, returns the
first non-null element from a sequence. Terraform 0.11's coalesce,
however, returns the first non-empty string from a list of strings.

This new coalesce function aims to preserve terraform's documented
functionality while adding support for additional argument types. The
tests include those in go-cty and adapted tests from the 0.11 version of
coalesce.

* website/docs: update coalesce function document
2019-04-12 13:57:52 -04:00
Chris Griggs e35e3d367e
Merge pull request #21001 from cgriggs01/cgriggs01-community-prvdrs
[Website] new community providers
2019-04-12 09:21:21 -07:00
Kristin Laemmert 1c95b21c6c
command/output: get the state path from the workspace or CLI argument (#20994)
Previously this command was setting the state path to the default state
file, instead of honoring the backend configuration.
2019-04-12 07:37:27 -04:00
Nick Fagerlund 88982fdbc3
website: in functions sidebar, default lists to collapsed (#20945)
Find-in-page is still supported with the 'expand/collapse all' control.
2019-04-11 16:54:18 -07:00
Sander van Harmelen f4607435aa
Merge pull request #20989 from hashicorp/svh/b-panic
Prevent a panic caused by writing to a nil map
2019-04-11 15:16:47 +02:00
Sander van Harmelen 90bc237b7b Prevent a panic caused by writing to a nil map 2019-04-11 14:34:14 +02:00
Martin Atkins 88e76fa9ef configs/configschema: Introduce the NestingGroup mode for blocks
In study of existing providers we've found a pattern we werent previously
accounting for of using a nested block type to represent a group of
arguments that relate to a particular feature that is always enabled but
where it improves configuration readability to group all of its settings
together in a nested block.

The existing NestingSingle was not a good fit for this because it is
designed under the assumption that the presence or absence of the block
has some significance in enabling or disabling the relevant feature, and
so for these always-active cases we'd generate a misleading plan where
the settings for the feature appear totally absent, rather than showing
the default values that will be selected.

NestingGroup is, therefore, a slight variation of NestingSingle where
presence vs. absence of the block is not distinguishable (it's never null)
and instead its contents are treated as unset when the block is absent.
This then in turn causes any default values associated with the nested
arguments to be honored and displayed in the plan whenever the block is
not explicitly configured.

The current SDK cannot activate this mode, but that's okay because its
"legacy type system" opt-out flag allows it to force a block to be
processed in this way anyway. We're adding this now so that we can
introduce the feature in a future SDK without causing a breaking change
to the protocol, since the set of possible block nesting modes is not
extensible.
2019-04-10 14:53:52 -07:00
Martin Atkins a20084dc0e configs/configschema: EmptyValue methods
These helpers determine the value that would be used for a particular
schema construct if the configuration construct it represents is not
present (or, in the case of *Block, empty) in the configuration.

This is different than cty.NullVal on the implied type because it might
return non-null "empty" values for certain constructs if their absence
would be reported as such during a decode with no required attributes or
blocks.
2019-04-10 14:53:52 -07:00
Michael Conlon 44c9e81d4c website: fix typo on the "terraform console" command page 2019-04-10 12:17:28 -07:00
cgriggs01 a674d3fb7b [Website] new community providers 2019-04-10 11:00:15 -07:00
Robert J b4e8e63618 Create smaller docker images for releases
Now we'll use build containers to perform preparation steps, causing the release
images to contain only Terraform itself and git/openssh.
2019-04-10 10:06:04 -07:00
James Bardin 5066003284
Merge pull request #20977 from hashicorp/jbardin/set-elem-get-ok
Don't allow unknown values in the config when generating the apply Diff
2019-04-10 11:16:48 -04:00
James Bardin 8d32229f7d add test fetching computed set value by address
This is not a recommended method, but it does serve to verify that the
set values in the ResourceData internal state are correctly computed,
which indicates that the expected configuration was passed in.
2019-04-10 09:42:54 -04:00
James Bardin af8115dc9b removing the ~ set flag is no longer needed
The computed set sigil ~ should no longer appear in the diffs, because
the config will be cleaned before generating the diff.
2019-04-10 09:39:45 -04:00
James Bardin 5f52aba3ae Remove unknown value strings from apply diffs
The synthetic config value used to create the Apply diff should contain
no unknown config values. Any remaining UnknownConfigValues were due to
that being used as a placeholder for values yet to be computed, and
these should be marked NewComputed in the diff.
2019-04-10 09:34:39 -04:00
James Bardin 7df3275120
Merge pull request #20957 from hashicorp/jbardin/shim-schemas
New methods for obtaining CoreConfigSchema for shimming
2019-04-08 18:16:40 -04:00
James Bardin 3ec93710fc PromoteSingle is used in 0.11 mode 2019-04-08 17:12:39 -04:00
James Bardin a3d58665ad use LegacyResourceSchema
rather than the previous .CoreConfigSchemaForShimming
2019-04-08 16:45:35 -04:00
James Bardin 8730d99309 LegacyResourceSchema to remove 0.12 features
This allows us to call CoreConfigSchema and return something that looks
like the original schema.
2019-04-08 16:45:35 -04:00
James Bardin c5023c7702 cleanup after AsSingle removal 2019-04-08 16:45:35 -04:00
James Bardin 1a9c06d0f5 Revert "helper/schema: Implementation of the AsSingle mechanism"
This reverts commit 1987a92386.
2019-04-08 16:45:35 -04:00
James Bardin 4dbe6add77 Revert "helper/schema: Schema.AsSingle flag"
This reverts commit 4c0c74571de9c96ad2902ccf4af962ec495cd5d4.
2019-04-08 16:45:35 -04:00
James Bardin af9dacb9f9 add failing test for diff.Apply
Add a diff test using a shcema with ConfigModeAttr.

It's in the test provider, because that is what is mostly responsible
for exercising diff.Apply, and where the other tests are.
2019-04-08 16:45:06 -04:00
Sander van Harmelen f2d9821edf
Update CHANGELOG.md 2019-04-08 19:33:52 +02:00
Sander van Harmelen 8f8df16d2b
Merge pull request #20952 from hashicorp/svh/b-slug-uploads
gomod: update `go-tfe`
2019-04-08 19:32:04 +02:00
Pam Selle c514867367
Merge pull request #20944 from pselle/registry-link
Only display status link if public registry used
2019-04-08 10:25:10 -04:00
Sander van Harmelen 8a430113f6 gomod: update `go-tfe` 2019-04-08 11:13:14 +02:00
Martin Atkins ffcf9fc51b lang/blocktoattr: Apply fixup within already-fixed-up blocks too
When a top-level list-of-object contains an attribute that is also
list-of-object we need to do the fixup again inside the nested body (using
our synthetic attributes-only schema) so that the attr-as-blocks mechanism
can apply within the nested blocks too.
2019-04-05 14:22:41 -07:00
Pam Selle 346e341ff2 Only display status link if public registry used
Updates to throw a specific error if using the defined public
registry vs. another registry.
2019-04-05 16:49:27 -04:00
Matthew Sanabria 0d0a1128e4
Clarifying behavior for destroy-time provisioners (#20819) 2019-04-05 14:22:16 -04:00
Matthew Sanabria be04e70a0f
Adding documentation for TF_CLI_CONFIG_FILE environment variable (#20834)
Fixes #15849
2019-04-05 14:21:40 -04:00
Martin Atkins 26c1e40ad7 configs/configupgrade: Normalize number literals to decimal
The v0.12 language supports numeric constants only in decimal notation, as
a simplification. For rare situations where a different base is more
appropriate, such as unix-style file modes, we've found it better for
providers to accept a string containing a representation in the
appropriate base, since that way the interpretation can be validated and
it will be displayed in the same way in the rendered plan diff, in
outputs, etc.

We use tv.Value() here to mimick how HCL 1 itself would have interpreted
these, and then format them back out in the canonical form, which
implicitly converts any non-decimal constants to decimal on the way
through.
2019-04-04 18:09:44 -07:00
Martin Atkins ac2052f0bb website: correct the title of the "matchkeys" function page 2019-04-04 15:35:13 -07:00
Martin Atkins 99f2623d10 website: Documentation of the special "attributes as blocks" mode
The re-introduction of some of the ambiguity between argument and nested
block syntax (for compatibility with existing provider patterns)
unfortunately leads to some interesting consequences for attributes using
this mode.

While the behavior is generally as before in straightforward cases, this
page aims to spell out some of the different usage patterns explicitly
for the benefit of those writing more complex configurations, such as
generic re-usable modules where using argument vs. block syntax leads to
some real differences.

This page is intentionally not linked from anywhere in the part of the
website maintained in the Terraform repository. Instead, it can be linked
from the provider documentation for any argument where this pattern is
used, to help users understand the ways in which that argument might
deviate from the usual behaviors of arguments vs. nested blocks.
2019-04-04 13:49:37 -07:00
Jeff 3110dde1d1 Fix docs typo (#20924)
* fix docs typo

* restore trailing newline
2019-04-04 11:21:36 -04:00
Martin Atkins 4d52999538 lang: EvalBlock should use ReferencesInBlock
Previously it was calling directly to hcldec.Variables, and thus missing
the special fixups we do inside ReferencesInBlock to deal with
Terraform-specific concerns such as our attribute-as-blocks preprocessing.
2019-04-03 15:57:17 -07:00
James Bardin 90b70bba08
Merge pull request #20923 from hashicorp/jbardin/planned-computed
Allow all planned computed diff fields
2019-04-03 18:40:32 -04:00
James Bardin 7b67105407 don't strip new-computeds from plan diffs
Stripping these was a patch for some provider behavior which was fixed
in other ways, and is no longer needed.
Removing this allows us to implement correct CusomizeDiffFuncs in
providers so that they can mark fields with empty values as computed
during a plan.
2019-04-03 17:37:58 -04:00
James Bardin f52a6630f5 create a downstream failure from a computed value
These are the largest source of the old "diffs didn't match after apply"
errors. It's almost always an upstream dependency that caused the final
error.
2019-04-03 17:36:08 -04:00
Kristin Laemmert 3aa4ac43f9
configs/configupgrade: return if hil.Parse() produces an error. (#20920)
Fixes #20917
2019-04-03 14:20:59 -04:00
James Bardin 51ddc554f5
Merge pull request #20909 from hashicorp/jbardin/validate-config-nulls
Validate configuration shims for nulls in lists
2019-04-03 14:06:22 -04:00
Kristin Laemmert f8a5e17d3d
command/format: improve "source" of error messages regarding missing arguments (#20907)
* vendor: update hcl2 dependency
* command/format: revert diagnostic format behavior if snippet or highlight range is empty
2019-04-03 14:04:59 -04:00
James Bardin e024960c74 Revert "filter nulls when shimming a config"
This reverts commit 97bde5467c.
2019-04-03 13:52:56 -04:00
James Bardin f5395bd98a validate null values in shimmed configs
A list-like attribute containing null values will present a list to
helper/schema with nils, which can cause panics. Since null values were
not possible in configuration before HCL2 and not supported by the
legacy SDK, return an error to the user.
2019-04-03 11:10:24 -04:00
Brian Flad 87f141000b
Update CHANGELOG for #20891 2019-04-03 08:54:39 -04:00
Brian Flad d5a8545a15
Merge pull request #20891 from hashicorp/b-helper-schema-setSet-panic
helper/schema: Prevent setSet() panic with typed nil
2019-04-03 08:52:38 -04:00
James Bardin 7ced46425e
Merge pull request #20906 from hashicorp/jbardin/grpc-recv-limit
increase grpc recv limit
2019-04-02 16:46:30 -04:00