Commit Graph

26580 Commits

Author SHA1 Message Date
James Bardin c0a5214aec do not look for all descendants from root outputs
The output destroy node only needs to connect to each of the output's
up-edges in order to be connected transitively to all of the outputs
dependencies. In large, highly-connected graphs, this may save
considerable time for each output.
2020-06-11 09:53:09 -04:00
James Bardin 8e4bd669e8 test Set.Copy, Graph.UpEdges, Graph.DownEdges 2020-06-11 09:53:09 -04:00
James Bardin 268959f4be make UpEdges and DownEdges return a copy
The public functions for the graph UpEdges and DownEdges is returning
the internal Set from the graph, meaning that callers could
inadvertently corrupt the graph structure by editing the returned Sets.

Make UpEdges and DownEdges return a copy of the set, while retaining the
efficient no-copy behavior for internal callers.
2020-06-11 09:53:09 -04:00
Petros Kolyvas 831fd2b842
Merge pull request #25212 from Redeux/kubernetes-backened-doc
backend/kubernetes: Kubernetes supports multiple workspaces
2020-06-11 09:49:50 -04:00
Phil Sautter fa3fe37684 backend/kubernetes: Kubernetes supports multiple workspaces 2020-06-11 08:35:22 -04:00
James Bardin 8f4395a1e9 ensure modules are expanded during import
In order to import into a module, we have to make sure that module has
registered the expansion data.
2020-06-10 17:02:41 -04:00
Alisdair McDiarmid 9204498fe5 configs/configload: Remove unused SourceAddr funcs
isLocalSourceAddr and isRegistrySourceAddr are also present in
internal/initwd/getter.go, and they are unused in this package.
2020-06-10 16:26:04 -04:00
Alisdair McDiarmid abedfd3a0f
Update CHANGELOG.md 2020-06-10 16:23:15 -04:00
Alisdair McDiarmid 652d4e40f4
Merge pull request #25190 from hashicorp/alisdair/providers-tree
command/providers: Show provider requirements tree
2020-06-10 16:21:49 -04:00
James Bardin 13c6b83e29 expanded module targeting test 2020-06-10 16:11:05 -04:00
James Bardin 98b323d815 ignore module indices in pre-expansion targeting
The TargetsTransformer ignored resource indices before expansion could
happen, but was not handling module indices. Ensure that we collapse all
pre-expansion addresses to "configuration" addresses, with no module or
resource keys.
2020-06-10 15:39:29 -04:00
James Bardin a2d8376eeb TransformTargets cannot depends on knowing Destroy
There is no reliable way to know if `destroy` was called from the cli.
2020-06-10 15:38:35 -04:00
James Bardin aa7e6f8d86 nodeCloseModule needs to be kept for downstream 2020-06-10 15:37:55 -04:00
James Bardin 7022345b8f Targets was being dropped in data source nodes 2020-06-10 15:36:44 -04:00
John Houston ec3612c3d0
Fix errors in kubernetes backend documentation 2020-06-10 14:00:01 -04:00
James Bardin b861f5a4d7 unkeyed target ModulesInstance can be Modules
If the last step in a module target is an unkeyed instance, and it's
being compared against keyed instances, we have to assume it was
intended to be used as a Module rather than a ModuleInstance.
2020-06-09 21:58:58 -04:00
Alisdair McDiarmid 1c1e4a4de0 command/providers: Show provider requirements tree
Providers can be required from multiple sources. The previous
implementation of the providers sub-command displayed only a flat list
of provider requirements, which made it difficult to see which modules
required each provider.

This commit reintroduces the tree display of provider requirements, and
adds a separate output block for providers required by existing state.
2020-06-09 14:21:53 -04:00
James Bardin 299aa31b43 update CHANGELOG.md 2020-06-08 21:20:58 -04:00
James Bardin 7800ef63d4
Merge pull request #19525 from dramich/k8sback
backend/kubernetes: Add Kubernetes as a backend
2020-06-08 15:59:32 -04:00
Masayuki Morita ee913a1c87
command/0.13upgrade: make confirmation more user-friendly (#25142)
I feel the current confirmation prompt for 0.13upgrade command is
ambiguous what is expected. Actually, when I used it for the first time,
I cancelled it by typing `y` instead of `yes`.

I believe it would be great if the 0.13upgrade command tell us the
expected value for confirmation like 0.12upgrade.
2020-06-08 13:36:19 -04:00
Alisdair McDiarmid f2beafd348
Update CHANGELOG.md 2020-06-08 10:45:16 -04:00
Alisdair McDiarmid b18d35e258
Merge pull request #25156 from hashicorp/alisdair/fix-empty-overlap-diagnostic-format
command/format: Fix empty overlap diagnostics
2020-06-08 10:44:02 -04:00
James Bardin b829de086f update CHANGELOG.md 2020-06-08 10:24:23 -04:00
James Bardin ea0b4df96f
Merge pull request #25144 from sharkyze/configs/fix-looksLikeSentences-index-out-of-range
config/name_values: fix index out of range in looksLikeSentences
2020-06-08 10:22:48 -04:00
James Bardin fdfe7e5cb7 update CHANGELOG.md 2020-06-08 10:21:18 -04:00
James Bardin 0b5746b6bb
Merge pull request #25176 from hashicorp/jbardin/module-expansion-transformer
Incorrect early return in module expansion transformer
2020-06-08 10:19:05 -04:00
Kristin Laemmert 30ab95fb55
Update CHANGELOG.md 2020-06-08 08:29:15 -04:00
Kristin Laemmert 58bcc2e9bb
addrs: detect builtin provider when parsing legacy provider string (#25154)
* addrs: detect builtin provider when parsing legacy provider string

The ParseLegacyAbsProviderConfig was not detecting builtin providers
("terraform"), which caused issues for all users with 0.12 state and
the "terraform_remote_state" data source. Since "terraform" is the only
built-in provider this adds a very simple check to the parser so it
properly returns the builtin FQN.

* add tests to the addrs package
2020-06-08 08:27:36 -04:00
Alisdair McDiarmid d741c3f917
Update CHANGELOG.md 2020-06-08 07:21:47 -04:00
Alisdair McDiarmid 3f62e4686b
Merge pull request #25146 from hashicorp/alisdair/simplify-makefile
Makefile: remove unused targets
2020-06-08 07:17:54 -04:00
Alisdair McDiarmid ba374baef0 Makefile: remove unused targets
Most of the targets in the Makefile have not been used in either CI or
the normal development workflow for some time. Removing them clarifies
that the expected way to build Terraform locally is simple: go install.

Remaining targets:

- fmtcheck, generate: these are used in CI to verify that the code is
  correctly formatted and that generate has been run appropriately
- protobuf: referenced in CONTRIBUTING.md as the simplest way to build
  the proto files
- website, website-test: used to compile and test the local website in
  isolation from the terraform-website repo
2020-06-08 07:02:54 -04:00
James Bardin 198c632e04 incorrect early return during module transformer
The recursive call should only return immediately on error.

The switch statement to find the current path should not use
ReferenceOutside, as we are getting the path for configuration, not for
references. This case would not have been taken currently, since all
GraphNodeReferenceOutside are also GraphNodeModulePath.
2020-06-06 21:45:05 -04:00
James Bardin 242a916a17 variable ModulePath must return configured path
The parent path case is handled ReferenceOutside
2020-06-06 21:45:05 -04:00
James Bardin 9722686b62 validation test with multiple nested modules 2020-06-06 21:44:41 -04:00
John Houston 01ebdd27f2 Rework soak test to error on unlock failure 2020-06-05 18:27:30 -04:00
John Houston b0f7e273e8 Add errors for lock disappearing 2020-06-05 18:10:24 -04:00
Chris Griggs 4b99c9a88d [Website] provider links 2020-06-05 14:27:22 -07:00
Brian Flad 5e3c02ba27
Update CHANGELOG for #25134 2020-06-05 16:43:20 -04:00
Brian Flad ba081aa10a
backend/s3: Updates for Terraform v0.13.0 (#25134)
* deps: Update github.com/hashicorp/aws-sdk-go-base@v0.5.0

Updated via:

```
$ go get github.com/hashicorp/aws-sdk-go-base@v0.5.0
$ go mod tidy
$ go mod vendor
```

* backend/s3: Updates for Terraform v0.13.0

Reference: https://github.com/hashicorp/terraform/issues/13410
Reference: https://github.com/hashicorp/terraform/issues/18774
Reference: https://github.com/hashicorp/terraform/issues/19482
Reference: https://github.com/hashicorp/terraform/issues/20062
Reference: https://github.com/hashicorp/terraform/issues/20599
Reference: https://github.com/hashicorp/terraform/issues/22103
Reference: https://github.com/hashicorp/terraform/issues/22161
Reference: https://github.com/hashicorp/terraform/issues/22601
Reference: https://github.com/hashicorp/terraform/issues/22992
Reference: https://github.com/hashicorp/terraform/issues/24252
Reference: https://github.com/hashicorp/terraform/issues/24253
Reference: https://github.com/hashicorp/terraform/issues/24480
Reference: https://github.com/hashicorp/terraform/issues/25056

Changes:

```
NOTES

* backend/s3: Deprecated `lock_table`, `skip_get_ec2_platforms`, `skip_requesting_account_id` arguments have been removed
* backend/s3: Credential ordering has changed from static, environment, shared credentials, EC2 metadata, default AWS Go SDK (shared configuration, web identity, ECS, EC2 Metadata) to static, environment, shared credentials, default AWS Go SDK (shared configuration, web identity, ECS, EC2 Metadata)
* The `AWS_METADATA_TIMEOUT` environment variable no longer has any effect as we now depend on the default AWS Go SDK EC2 Metadata client timeout of one second with two retries

ENHANCEMENTS

* backend/s3: Always enable shared configuration file support (no longer require `AWS_SDK_LOAD_CONFIG` environment variable)
* backend/s3: Automatically expand `~` prefix for home directories in `shared_credentials_file` argument
* backend/s3: Add `assume_role_duration_seconds`, `assume_role_policy_arns`, `assume_role_tags`, and `assume_role_transitive_tag_keys` arguments

BUG FIXES

* backend/s3: Ensure configured profile is used
* backend/s3: Ensure configured STS endpoint is used during AssumeRole API calls
* backend/s3: Prefer AWS shared configuration over EC2 metadata credentials
* backend/s3: Prefer ECS credentials over EC2 metadata credentials
* backend/s3: Remove hardcoded AWS Provider messaging
```

Output from acceptance testing:

```
--- PASS: TestBackend (16.32s)
--- PASS: TestBackendConfig (0.58s)
--- PASS: TestBackendConfig_AssumeRole (0.02s)
--- PASS: TestBackendConfig_conflictingEncryptionSchema (0.00s)
--- PASS: TestBackendConfig_invalidKey (0.00s)
--- PASS: TestBackendConfig_invalidSSECustomerKeyEncoding (0.00s)
--- PASS: TestBackendConfig_invalidSSECustomerKeyLength (0.00s)
--- PASS: TestBackendExtraPaths (13.21s)
--- PASS: TestBackendLocked (28.98s)
--- PASS: TestBackendPrefixInWorkspace (5.65s)
--- PASS: TestBackendSSECustomerKey (17.60s)
--- PASS: TestBackend_impl (0.00s)
--- PASS: TestForceUnlock (17.50s)
--- PASS: TestKeyEnv (50.25s)
--- PASS: TestRemoteClient (4.78s)
--- PASS: TestRemoteClientLocks (16.85s)
--- PASS: TestRemoteClient_clientMD5 (12.08s)
--- PASS: TestRemoteClient_impl (0.00s)
--- PASS: TestRemoteClient_stateChecksum (17.92s)
```
2020-06-05 16:41:32 -04:00
Alisdair McDiarmid c87c0a9d2a command/format: Fix empty overlap diagnostics
Diagnostics where the highlight range has an empty overlap with a line
would skip lines of the output. This is because if two ranges abut each
other, they can be considered to overlap, but that overlap is empty.
This results in an edge case in the diagnostic printer which causes the
line not to be printed.
2020-06-05 16:17:27 -04:00
Chris Stephens 2dd64a7816
plans: Update error message for apply validation (#21312)
* Update error message for apply validation

Add a hint that the validation failure has occurred at the root of the resource
schema to the error message. This is because the root resource has an empty
path when being validated and the path is being relied upon to provide context
into the error message.
2020-06-05 15:08:10 -04:00
Alisdair McDiarmid 6c3ad8eaad
Merge pull request #25147 from hashicorp/dont-use-demo-in-config
use example.com address in consul backend config
2020-06-05 13:46:55 -04:00
John Houston e5f7237582 Soak test for kubernetes backend 2020-06-05 13:32:59 -04:00
Matthew Irish e36ed8968b
use example.com address in consul backend config
Currently the example config for the Consul backend uses a live Consul demo cluster at `demo.consul.io`. This results in TF state with sensitive information and all being stored on a public site when users just copy and paste the config. This PR changes it so that the config address isn't the public demo cluster.
2020-06-05 10:35:32 -05:00
Kristin Laemmert 0b38ab3078
Update CHANGELOG.md 2020-06-05 09:13:50 -04:00
Kristin Laemmert e6cf6cd758
backend/remote: do not panic if PrepareConfig or Configure receive null (#25135)
* backend/remote: do not panic if PrepareConfig or Configure receive null
objects

If a user cancels (ctrl-c) terraform init while it is requesting missing
configuration options for the remote backend, the PrepareConfig and
Configure functions would receive a null cty.Value which would result in
panics. This PR adds a check for null objects to the two functions in
question.

Fixes #23992
2020-06-05 09:11:44 -04:00
samir elsharkawy 5dfc266da9 config/name_values: fix index out of range in looksLikeSentences 2020-06-05 13:29:43 +02:00
He Guimin 5b4950e2cb backend(oss): supports setting HTTPS_PROXY 2020-06-05 14:48:58 +08:00
James Bardin 023454a3a6
Merge pull request #25138 from hashicorp/jbardin/module-data-depends-on
Data source within modules using depends_on
2020-06-04 21:54:04 -04:00
James Bardin c3ec4d8e26 get whether parent modules have depends_on set
During refresh, data sources need to know if their parent modules have
depends_on configured at all. Pass this info back through the search for
depends_on resources, and delay refresh when it's set.
2020-06-04 18:07:06 -04:00