Commit Graph

28485 Commits

Author SHA1 Message Date
Stephen e39abbf6f0
fix regex logical or documentation (#27637)
* fix regex logical or documentation

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2021-02-08 11:04:38 -05:00
Philip Sahli d7cbf8f1fc
Fix typo 2021-02-08 16:56:19 +01:00
Kristin Laemmert 1a8d873c22 plugin6: new plugin package to support plugin protocol v6
plugin6 includes a `convert` package to handle conversion between the
plugin protocol and configschema, and the GRPCProviderPlugin interface
implementation for protocol v6.
2021-02-05 15:51:16 -05:00
Alisdair McDiarmid 7cae76383a cli: Fix for provider requirements in JSON plan
The JSON plan output format includes a serialized, simplified version of
the configuration. One component of this config is a map of provider
configurations, which includes version constraints.

Until now, only version constraints specified in the provider config
blocks were exposed in the JSON plan output. This is a deprecated method
of specifying provider versions, and the recommended use of a
required_providers block resulted in the version constraints being
omitted.

This commit fixes this with two changes:

- When processing the provider configurations from a module, output the
  fully-merged version constraints for the entire module, instead of any
  constraints set in the provider configuration block itself;
- After all provider configurations are processed, iterate over the
  required_providers entries to ensure that any configuration-less
  providers are output to the JSON plan too.

No changes are necessary to the structure of the JSON plan output, so
this is effectively a semantic level bug fix.
2021-02-05 14:01:58 -05:00
Kristin Laemmert da6ac9d6cd plans/objchange: add handling of NestedTypes inside attributes
- rename ProposedNewObject to ProposedNew:
Now that there is an actual configschema.Object it will be clearer if
the function names match the type the act upon.

- extract attribute-handling logic from assertPlanValid and extend
A new function, assertPlannedAttrsValid, takes the existing
functionality and extends it to validate attributes with NestedTypes.
The NestedType-specific handling is in assertPlannedObjectValid, which
is very similar to the block-handling logic, except that nulls are a
valid plan (an attribute can be null, but not a block).
2021-02-05 13:41:06 -05:00
Kristin Laemmert 3ad720e9dc configs/configschema: add new NestedType to attribute
This commit adds a new field, NestedType, to the Attribute schema, and
extends the current Attribute decoderSpec to account for the new type.
The codepaths are mostly unused and included in a separate commit to
verify that the included changes do not impact any other tests yet.
2021-02-05 13:34:55 -05:00
Kristin Laemmert f3a057eb35 plugin-protocol v6
This is the first commit for plugin protocol v6. This is currently
unused (dead) code; future commits will add the necessary conversion
packages, extend configschema, and modify the providers.Interface.

The new plugin protocol includes the following changes:

- A new field has been added to Attribute: NestedType. This will be the
  key new feature in plugin protocol v6
- Several massages were renamed for consistency with the verb-noun
  pattern seen in _most_ messages.
- The prepared_config has been removed from PrepareProviderConfig
  (renamed ValidateProviderConfig), as it has never been used.
- The provisioner service has been removed entirely. This has no impact
  on built-in provisioners. 3rd party provisioners are not supported by
  the SDK and are not included in this protocol at all.
2021-02-05 13:19:55 -05:00
Alisdair McDiarmid 32d2084387
Merge pull request #27679 from hashicorp/alisdair/apply-destroy-test-fixes
cli: Better diagnostics for apply positional args
2021-02-05 13:05:19 -05:00
Robin Norwood f279bf58c4
Merge pull request #27689 from hashicorp/rln-data-sources-tutorial
Add crosslink to new Learn tutorial
2021-02-05 09:44:33 -06:00
Alex Chan 4ec80fa18d Correct the spelling of heirarchy/hierarchy throughout 2021-02-05 15:07:04 +00:00
Robin Norwood 181048b913 Add crosslink to new Learn tutorial 2021-02-04 13:43:03 -06:00
Alisdair McDiarmid d7613a0aac cli: Better diagnostics for apply positional args
The previous changes removing support for using the trailing positional
argument as a working directory missed a spot in the apply/destroy
command implementation. We still support this argument for applying a
saved plan:

    terraform apply foo.tfplan

However, if you pass a positional path which doesn't "look like" a plan
(for example, the path to a configuration directory), Terraform would
silently ignore it and continue.

This commit fixes that by adding an error message if the user specifies
a path which the plan loader rejects as not "looking like" a plan. This
message includes a reference to the `-chdir` flag as a pointer about
what to do next.

We also rearrange the error message when calling `terraform destroy`
with a plan file argument, and add test coverage for the above. While
we're here, update the destroy tests to copy the fixture directory,
chdir, and defer cleanup.
2021-02-04 10:27:18 -05:00
Alisdair McDiarmid 8057f19bb5
Update CHANGELOG.md 2021-02-04 10:16:31 -05:00
Alisdair McDiarmid 294bbd8b8c
Merge pull request #27681 from hashicorp/alisdair/remove-deprecated-destroy-force
cli: Remove deprecated destroy -force flag
2021-02-04 10:15:07 -05:00
Alisdair McDiarmid b2ba650c21 cli: Remove deprecated destroy -force flag
This dramatically simplifies the logic around auto-approve, which is
nice.

Also add test coverage for the manual approve step, for both apply and
destroy, answering both yes and no.
2021-02-03 15:05:05 -05:00
GreenHedgehog d4db1d1342 fix possible nil pointer dereference in azure sdk 2021-02-03 21:09:05 +03:00
James Bardin 030632e87e
Merge pull request #27668 from hashicorp/jbardin/parallelism-test
fix concurrent test relying on sleep
2021-02-03 09:39:42 -05:00
James Bardin 1e5a8e4dae fix concurrent test relying on sleep
Make an old concurrent test deterministic, and not rely on sleep for any
synchronization.
2021-02-03 09:20:08 -05:00
Alisdair McDiarmid c8f83e184b
Update CHANGELOG.md 2021-02-02 13:55:49 -05:00
Alisdair McDiarmid a51803ae0b
Merge pull request #27664 from hashicorp/alisdair/remove-positional-path-arguments
cli: Remove legacy positional path arguments
2021-02-02 13:50:58 -05:00
Pam Selle 84f5b863ef
Merge pull request #27635 from hashicorp/pselle/obj-compatible-set
Unmark values in couldHaveUnknownBlockPlaceholder before iteration
2021-02-02 13:44:49 -05:00
Alisdair McDiarmid 888f36aebb cli: Remove positional plan argument from graph
To make the command arguments easier to understand and extend, we are
moving away from positional arguments. This commit changes the graph
command to take a `-plan` flag instead of an optional trailing path.
2021-02-02 13:21:26 -05:00
Alisdair McDiarmid ca23a096d8 cli: Remove legacy positional path arguments
Several commands continued to support the legacy positional path
argument to specify a working directory. This functionality has been
replaced with the global -chdir flag, which is specified before any
other arguments, including the sub-command name.

This commit removes support for the trailing path parameter from
most commands. The only command which still supports a path argument is
fmt, which also supports "-" to indicate receiving configuration from
standard input.

Any invocation of a command with an invalid trailing path parameter will
result in a short error message, pointing at the -chdir alternative.

There are many test updates in this commit, almost all of which are
migrations from using positional arguments to specify a working
directory. Because of the layer at which these tests run, we are unable
to use the -chdir argument, so the churn in test files is larger than
ideal. Sorry!
2021-02-02 13:21:26 -05:00
James Bardin 9c16e5726e
Merge pull request #27620 from hashicorp/v-aws-sdk-go-v1.37.0
deps: Bump github.com/aws/aws-sdk-go@v1.37.0
2021-02-02 08:20:44 -05:00
Brian Flad 70aac9c551
command: Use different warning messaging in init command and move above potentially confusing output (#27514)
Reference: https://github.com/hashicorp/terraform/issues/27459
Reference: https://github.com/hashicorp/terraform/pull/27507

This follows the change in the plan command to move the development overrides warning above other output from the command that may exhibit unexpected behavior.
2021-02-01 10:50:08 -05:00
James Bardin cf09435526 update CHANGELOG.md 2021-02-01 09:37:52 -05:00
Pam Selle e6daf3dbf1 Unmark before ElementIterator in couldHaveUnknownBlockPlaceholder
This is needed for cases where a variable may be fetched and become
a member of a set, and thus the whole set is marked, which means
ElementIterator will panic on unmarked values
2021-01-29 17:06:12 -05:00
Alisdair McDiarmid 5df11f2013
Merge pull request #27633 from hashicorp/alisdair/count-hook-refactor
cli: Move resource count code to command package
2021-01-29 15:49:34 -05:00
Alisdair McDiarmid 5ca118b4e6 cli: Move resource count code to command package
CountHook is an implementation of terraform.Hook which is used to
calculate how many resources were added, changed, or destroyed during an
apply. This hook was previously injected in the local backend code,
which means that the apply command code has no access to these counts.

This commit moves the CountHook code into the command package, and
removes an unused instance of the hook in the plan code path. The goal
here is moving UI code into the command package.
2021-01-29 15:29:35 -05:00
James Bardin bd70df8392
Merge pull request #27621 from hashicorp/jbardin/plan-orphan-data-instance
removed orphaned data sources from the working state
2021-01-29 08:39:04 -05:00
James Bardin 2df2d210b4 removed orphaned data sources from the state
When evaluating orphaned data sources during plan, they need to be
removed from both the refresh state and the current working state.
2021-01-28 16:35:21 -05:00
Brian Flad ad8a2e8b91 deps: Bump github.com/aws/aws-sdk-go@v1.37.0
Changes:

```
* backend/s3: Support for AWS Single-Sign On (SSO) cached credentials
```

Updated via:

```
go get github.com/aws/aws-sdk-go@v1.37.0
go mod tidy
```

Please note that Terraform CLI will not initiate or perform the AWS SSO login flow. It is expected that you have already performed the SSO login flow using AWS CLI using the `aws sso login` command, or by some other mechanism before executing Terraform. More precisely, this credential handling must find a valid non-expired access token for the AWS SSO user portal URL in `~/.aws/sso/cache`. If a cached token is not found, is expired, or the file is malformed an error will be returned.

You can use configure AWS SSO credentials from the AWS shared configuration file by specifying the required keys in the profile:

```
sso_account_id
sso_region
sso_role_name
sso_start_url
```

For example, the following defines a profile "devsso" and specifies the AWS SSO parameters that defines the target account, role, sign-on portal, and the region where the user portal is located. Note: all SSO arguments must be provided, or an error will be returned.

```
[profile devsso]
sso_start_url = https:my-sso-portal.awsapps.com/start
sso_role_name = SSOReadOnlyRole
sso_region = us-east-1
sso_account_id = 123456789012
```

Additional Resources

* [Configuring the AWS CLI to use AWS Single Sign-On](https:docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html)
* [AWS Single Sign-On User Guide](https:docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html)
2021-01-28 15:22:01 -05:00
Pam Selle 29dd334fe8
Merge pull request #27611 from hashicorp/pselle/ignore-remote-version-docstring
Update docstring for ignore-remote-version
2021-01-27 16:59:01 -05:00
Alisdair McDiarmid 7cb5685037
Merge pull request #27609 from hashicorp/alisdair/remove-output-module-option
cli: Remove dead code for output -module flag
2021-01-27 15:51:27 -05:00
Pam Selle c1ede28a15 Update docstring for ignore-remote-version
Update docstring for ignore-remote-version to be more accurate,
as it's not whether the versions differ, but if they are incompatible
2021-01-27 15:40:00 -05:00
hashicorp-ci dc757c40d4 Cleanup after v0.15.0-alpha20210127 release 2021-01-27 19:11:42 +00:00
Alisdair McDiarmid 2e62e03b64 cli: Remove dead code for output -module flag
The -module flag to terraform output has been unimplemented since 0.12.
This commit removes some dead code and the specific error message for
this flag.

The website documentation for output does not mention this flag, so it
is unchanged.
2021-01-27 14:02:59 -05:00
hashicorp-ci 657ae46e27
Release v0.15.0-alpha20210127 2021-01-27 18:51:45 +00:00
Katy Moe de31787966 add missing import 2021-01-27 09:54:28 -08:00
Katy Moe 51c687c2db command: no visual warning hierarchy in -no-color
Commit e865faf adds visual indentation for diagnostic messages using various
vertical line characters. The present commit disables this behaviour when
running with colourised output disabled.

While the contents of stderr are not intended to be part of the Terraform API,
this is currently how the hashicorp/terraform-exec library detects certain
error types in order to present them as well-known Go errors to the user. Such
detection is complicated when vertical lines are added to the CLI output at
unpredictable points.

I expect this change will also be helpful for screen reader users.
2021-01-27 09:26:53 -08:00
Katy Moe bc51932e08 refactor: extract appendSourceSnippets 2021-01-27 09:26:53 -08:00
Pam Selle 1a16ce8c4e
Merge pull request #25687 from flimzy/setup
Grammar nit: "setup" as a verb should be spelled "set up"
2021-01-26 15:33:55 -05:00
Jonathan Hall 49ee3d3ef8 Grammar nit: "setup" as a verb should be spelled "set up" 2021-01-26 20:39:11 +01:00
Martin Atkins fda0f0404c
Update CHANGELOG.md 2021-01-26 09:16:51 -08:00
Pam Selle 5682f55908
Merge pull request #27597 from hashicorp/pselle/state-cli-docs
Update state mv help docs to use spaces instead of tabs
2021-01-26 11:47:14 -05:00
Pam Selle 552451547c
Merge pull request #26891 from andormarkus/Update_workspace_docs
website: Updating terraform workspace docs
2021-01-26 11:45:18 -05:00
Pam Selle 6da55c0521 Update grammar for flags 2021-01-26 11:35:44 -05:00
Andor Markus f658531883 Updating terraform workspace website list.html.md new.html.md select.html.md files thus it reflect the current version of Terraform CLI 2021-01-26 11:35:43 -05:00
Pam Selle 35d5ea5455 Update state mv help docs to use spaces instead of tabs
Adds a test to make sure that this text doesn't accidentally
get tabs added, without having a test that simply direct matches
the whole strings (which would be brittle to adding a tab to the
test validation)
2021-01-26 11:24:28 -05:00
Pam Selle c066127497
Merge pull request #27591 from hashicorp/pselle/taint-untaint-module
Remove -module option for taint and untaint
2021-01-26 09:02:23 -05:00