Commit Graph

23670 Commits

Author SHA1 Message Date
Sander van Harmelen 973e2a7cf9 core: add a context to the UIInput interface 2019-03-08 10:24:40 +01:00
James Bardin a95d97f066
Merge pull request #20595 from hashicorp/jbardin/normalize-objects
normalize all objects read from the provider
2019-03-06 17:13:23 -05:00
James Bardin 5c09f94695 remove eval TODO for NormalizeObjectFromLegacySDK
The normalization will take place in the provider shims, locating it
with the rest of the code that attempts to match the new and legacy
behavior.
2019-03-06 16:23:56 -05:00
James Bardin 5c40d6610c remove NormalizeObjectFromLegacySDK from diff
The NormalizeObjectFromLegacySDK calls have been moved into the
provider shims, so all objects generated by the provider should conform
now.
2019-03-06 16:21:32 -05:00
Brian Flad dfe83d9ad5
Merge pull request #20592 from hashicorp/d-sensitive-data-pgp-mention
docs/state: Adjust mention of PGP encryption from RDS to IAM
2019-03-06 16:02:47 -05:00
James Bardin 209a0a460a normalize all objects read from the provider
Use objchange.NormalizeObjectFromLegacySDK to ensure that all objects
returned from the provider match what is expected based on the
configuration according to the schemas.
2019-03-06 14:09:04 -05:00
Paul Tyng de6e33dcb0
Update provider_issue.md 2019-03-06 13:36:39 -05:00
Brian Flad b580f8ac2e
Merge pull request #20590 from hashicorp/d-commands-parallelism-default
command: Consistency implement and document parallelism default of 10
2019-03-06 12:16:52 -05:00
Brian Flad d1e5f9c2a2
docs/state: Adjust mention of PGP encryption from RDS to IAM
To better align with the current status of PGP usage and remove any confusion for the missing functionality.

References:
* https://www.terraform.io/docs/providers/aws/r/iam_access_key.html
* https://www.terraform.io/docs/providers/aws/r/db_instance.html
2019-03-06 12:12:10 -05:00
Brian Flad 20a814028d
command: Consistency implement and document parallelism default of 10
References:
* f4da82a023/command/command.go (L41)
* b9d8e96e0c/terraform/context.go (L149-L155)
2019-03-06 09:25:36 -05:00
Kristin Laemmert b9d8e96e0c
command/plan: plan output should indicate if a resource is being (#20580)
replaced because the instance was tainted.
2019-03-05 16:18:55 -08:00
Martin Atkins fe9a5592bc
Update CHANGELOG.md 2019-03-05 15:44:17 -08:00
Martin Atkins 709487b4f1 backend: Cap number of "undeclared variable" warnings at four
For users who in previous versions have relied on our lack of checking for
whether variables are declared, they may previously have seen an
overwhelming number of warnings when running Terraform v0.12.

Here we cap that number at three specific warnings and then one general
warning, so we can still give a specific source location for the first
couple (for users who have genuinely made a typo) but summarize away a
large number for those who are seeing this because they've not yet
migrated to using environment variables.
2019-03-05 15:42:08 -08:00
Martin Atkins 9336c7fba3 website: Revamped module-authoring docs for Terraform v0.12
As well as some general consolidation and reorganizing, this also includes
some updated advice for making the best use of new Terraform v0.12
features to create infrastructure building-blocks.

In particular, the "Module Usage" documentation is now consolidated into
the configuration section in order to bring all of our general language
documentation together, and the top-level "Modules" section is now
primarily focused on module _authors_ as an audience, covering topics such
as publishing modules and designing them for reuse.
2019-03-05 14:14:06 -08:00
James Bardin 3600f59bb7
Merge pull request #20525 from hashicorp/jbardin/extra-set-value
remove the partially-known ~ set sigil in diffs
2019-03-05 16:50:02 -05:00
James Bardin ec82528794
Merge pull request #20577 from hashicorp/jbardin/shim-list-elements
don't re-add removed list values even when planned
2019-03-05 15:44:49 -05:00
Kristin Laemmert 9402b86217
plugin/discovery: create target plugin directory if it does not exist (#20575)
If the user supplies a plugin cache dir, the provider installer was not
checking if target directory exists before linking the cached pluging.
2019-03-05 12:39:24 -08:00
James Bardin 2b4d030a69 don't re-add removed list values even when planned
Providers were not strict (and were not forced to be) about customizing
the diff when a computed attribute needed to be updated during apply.
The fix we have in place to prevent loss of information during the
helper/schema apply process would add in single missing value back in.

The first place this was caught was when we attempt to fix up the
flatmapped attributes. The 1->0 count error is now better handled by our
cty.Value normalization step, so we can remove the special apply case
here altogether

The next place is in normalizeNullValues, and since the intent was to
re-insert missing zero-value lists and sets, adding a check for a length
of 0 protects us from adding in extra elements.

The new test fixture emulated common provider behavior of re-computing
values without customizing the diff. Since we can work around it, and
core will provider appropriate warnings, the shims should try to
maintain the legacy behavior.
2019-03-05 15:31:08 -05:00
James Bardin 81c94f7ea7
Merge pull request #20561 from mars/postgres-backend-session-locks
Switch pg backend to session-level advisory locking
2019-03-05 15:03:32 -05:00
Mars Hall 34fa67c6b0 Correct pg backend error info 2019-03-05 11:37:08 -08:00
Mars Hall ccf549a62d Stricter pg backend locking during workspace creation 2019-03-05 11:19:56 -08:00
Kristin Laemmert d72defd044
command/show and state show: honor user-specified plugin-dir (#20557)
Previously, these commands were not checking if the user specified a
`-plugin-dir` flag during `terraform init` and would therefor fail if
providers were not in one of the standard directories.

Fixes #20547
2019-03-05 08:32:11 -08:00
Kristin Laemmert 6c896bc456
build: refresh go.googlesource.com cookie (#20558) 2019-03-05 08:31:36 -08:00
Mars Hall 31c9776d55 Switch pg backend to session-level advisory locking, to avoid rollback of partial state updates 2019-03-04 17:01:08 -08:00
James Bardin 47604c36c8 remove the partially-known ~ set sigil in diffs
The NewExtra values are stored outside the diff from plan, and the
original keys may not contain the ~ prefix. Adding the NewExtra back
into the diff with the mismatched key was causing an entire new set
element to be populated. Since this symbol isn't used to apply the diff
in helper/schema, we can simply strip them out.
2019-03-04 17:36:30 -05:00
James Bardin 3c34c047f7
Merge pull request #20553 from hashicorp/jbardin/invalid-timeouts-in-plan
Prevent unexpected timeout blocks from being planned
2019-03-04 17:11:52 -05:00
Justin Campbell e466bc4bb7
Merge pull request #20543 from hashicorp/hashicorp-signing-key
plugin/discovery: Verify sig against HashiCorp key
2019-03-04 09:47:09 -05:00
James Bardin 33d5ddf291 remove empty timeouts blocks in copyTimeoutValues
The hcl2shims will always add in the timeouts block, because there's no
way to differentiate a null single block from an empty one in the
flatmapped state. Since we are only concerned with keeping the prior
timeouts value, always set the new value to null, and then copy over the
prior value if it exists.
2019-03-02 11:30:37 -05:00
James Bardin e50be82da4 don't add empty blocks in ProposedNewObject
If the config contained a null block, don't convert it to a block with
empty values for the proposed new value.
2019-03-02 11:21:59 -05:00
James Bardin 369d512e22
Merge pull request #20546 from hashicorp/jbardin/backend-init-panic
don't panic of the users aborts backend input
2019-03-01 19:03:49 -05:00
James Bardin 2adf5801d9 don't panic of the users aborts backend input
When the user aborts input, it may end up as an unknown value, which
needs to be converted to null for PrepareConfig.

Allow PrepareConfig to accept null config values in order to fill in
missing defaults.
2019-03-01 18:45:06 -05:00
Kristin Laemmert 8fb4e5ce6e
command/show: differentiate between state schemas and plan schemas. (#20516)
When a planfile is supplied to the `terraform show -json` command, the
context that loads only included schemas for resources in the plan. We
found an edge case where removing a data source from the configuration
(though only if there are no managed resources from the same provider)
would cause jsonstate.Marshal to fail because the provider schema wasn't
in the plan context.

jsonplan.Marshal now takes two schemas, one for plan and one for state.
If the state schema is nil it will simply use the plan schemas.
2019-03-01 13:59:57 -08:00
Kristin Laemmert c4151b7c7c
command/show: fixing bugs in modulecalls (#20513)
* command/show: fixing bugs in modulecalls

jsonconfig and jsonplan both had subtle bugs with the logic for
marshaling module calls that only showed up when multiple modules were
referenced. This PR fixes those bugs and extends the existing tests to
include multiple modules.

* sort all the things, mostly for tests
2019-03-01 13:59:12 -08:00
Kristin Laemmert 21f6e3dffd
Mildwonkey/012 docs updated (#20542)
* docs: update plan command documentation. Fixes #19235

* docs: added a missing reserved variable name. Fixes #19159.

* website: add note that resource names cannot start with a number

* website: add some notes to the 0.12 upgrade guide
2019-03-01 12:30:51 -08:00
Justin Campbell 0574eadb62 plugin/discovery: Verify sig against HashiCorp key
https://github.com/hashicorp/terraform/pull/19389 introduced a change to
the provider GPG signature verification process, and removed the
hardcoded HashiCorp GPG key.

While the changes were intended and are still planned for a future
release, we should still be verifying all providers in the TF 0.12.0
release against the HashiCorp GPG key until a more robust key
verification procedure is in place.

Fixes https://github.com/hashicorp/terraform/issues/20527
2019-03-01 14:05:51 -05:00
Andriy Borodiychuk a0f3a2daa0 Update doc.go, fix typo (#20529) 2019-03-01 08:59:01 -08:00
John Slee 8f7b897d0c website: typo in outputs doc (#20520) 2019-03-01 08:25:49 -08:00
Martin Atkins 08f0f60908 website: Temporary link to the beta1 announcement from v0.12 guide
The announcement post contains the information about the temporary
situation where not all of the providers are compatible yet. Linking there
rather than duplicating the information in the upgrade guide means we'll
be able to update in one place as the situation changes.
2019-02-28 16:21:48 -08:00
Martin Atkins 6cd6f0275c website: Fix some broken links
In all the shuffling of these docs for v0.12 some of the links ended up
not lining up quite right.
2019-02-28 16:21:09 -08:00
James Bardin 8f7e5b75fc
Merge pull request #20522 from hashicorp/jbardin/sdk-shims
Unexpected empty and computed values
2019-02-28 19:17:50 -05:00
James Bardin 49230f8198 existing fields cannot become computed during plan
Fields with no change can only become computed during initial creation.
2019-02-28 18:45:11 -05:00
James Bardin 9a39af5047 1->0 set changes non longer should happen in Read
The new normalization should make preventing those changes unnecessary,
and will also prevent extra empty elements from being added when
resources are refreshed.
2019-02-28 17:47:11 -05:00
Radek Simko 0dc3ca966a
Merge pull request #20509 from hashicorp/vendor-bump-crypto
vendor: go get golang.org/x/crypto@31a38585487a
2019-02-28 22:12:42 +00:00
Martin Atkins 1e25ccf11a release: clean up after v0.12.0-beta1 2019-02-28 21:22:37 +00:00
Martin Atkins 09f521a682
v0.12.0-beta1 release prep 2019-02-28 21:11:02 +00:00
Radek Simko 242de8ff28
vendor: go get golang.org/x/crypto@31a38585487a 2019-02-28 08:32:43 +00:00
Martin Atkins f193b11073 command/format: Normalize before/after values before rendering
We are now allowing the legacy SDK to opt out of the safety checks we try
to do after plan and apply, and so in such cases the before/after values
in planned changes may be inconsistent with our usual rules.

To avoid adding lots of extra complexity to the diff renderer to deal with
these situations, instead we'll normalize the handling of nested blocks
prior to using these values.

In the long run it'd be better to do this normalization at the source,
immediately after we receive an object from a provider using the opt-out,
but we're doing this at the outermost layer for now to avoid risking
unintended impacts on other Terraform Core components when we're just
about to enter the beta phase of the v0.12.0 release cycle.
2019-02-27 16:53:29 -08:00
Martin Atkins c280c27d87 plans/objchange: func NormalizeObjectFromLegacySDK
Now that we have an opt-out to let the legacy SDK return values that are
inconsistent with the new conventions for representing configuration,
various parts of Terraform must now be prepared to deal with
inconsistencies.

This function normalizes the most egregious inconsistencies relating to
the representation of nested blocks, freeing any recipient of its result
from worrying about these inconsistencies itself.
2019-02-27 16:53:29 -08:00
Kristin Laemmert 5ebf8b2992
website: fix link (#20501) 2019-02-27 12:21:20 -08:00
Brian Flad 364c3e70b7
Merge pull request #20497 from hashicorp/f-s3-backend-logging-and-user-agent
backend/s3: Add debug logging and user agent
2019-02-27 14:29:54 -05:00