Commit Graph

27776 Commits

Author SHA1 Message Date
hashicorp-ci d631eca23c
Release v0.15.0-alpha20210210 2021-02-10 17:40:24 +00:00
Pam Selle 0a99757ecf
Merge pull request #27722 from hashicorp/pselle/init-installed
Emit ProviderAlreadyInstalled when provider installed
2021-02-10 10:02:21 -05:00
Pam Selle f97f8c2a9b
Merge pull request #27708 from philipsahli/patch-1
Fix typo
2021-02-09 11:14:16 -05:00
Pam Selle aa24bfec47 Emit ProviderAlreadyInstalled when provider installed
Emit the ProviderAlreadyInstalled event when we successfully verify
that we've already installed this provider and are skipping
installation
2021-02-09 11:08:49 -05:00
Alisdair McDiarmid 96be094ecd
Merge pull request #27711 from hashicorp/alisdair/fix-target-flag-parsing-and-add-tests
cli: Improve error for invalid -target flags
2021-02-09 09:15:02 -05:00
Alisdair McDiarmid 4991cc4835 cli: Improve error for invalid -target flags
Errors encountered when parsing flags for apply, plan, and refresh were
being suppressed. This resulted in a generic usage error when using an
invalid `-target` flag.

This commit makes several changes to address this. First, these commands
now output the flag parse error before exiting, leaving at least some
hint about the error. You can verify this manually with something like:

    terraform apply -invalid-flag

We also change how target attributes are parsed, moving the
responsibility from the flags instance to the command. This allows us to
customize the diagnostic output to be more user friendly. The
diagnostics now look like:

```shellsession
$ terraform apply -no-color -target=foo

Error: Invalid target "foo"

Resource specification must include a resource type and name.
```

Finally, we add test coverage for both parsing of target flags, and at
the command level for successful use of resource targeting. These tests
focus on the UI output (via the change summary and refresh logs), as the
functionality of targeting is covered by the context tests in the
terraform package.
2021-02-08 13:48:04 -05:00
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
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
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
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
Pam Selle dd7b412d56
Merge pull request #27582 from hashicorp/pselle/reuse_targetdir_providers
Reuse installed target dir providers in init
2021-01-25 18:28:40 -05:00