Commit Graph

29572 Commits

Author SHA1 Message Date
Martin Atkins
1425374371 providers: A type for all schemas for a particular provider
Previously the "providers" package contained only a type for representing
the schema of a particular object within a provider, and the terraform
package had the responsibility of aggregating many of those together to
describe the entire surface area of a provider.

Here we move what was previously terraform.ProviderSchema to instead be
providers.Schemas, retaining its existing API otherwise, and leave behind
a type alias to allow us to gradually update other references over time.

We've gradually been shrinking down the responsibilities of the
"terraform" package to just representing the graph components and
behaviors anyway, but the specific motivation for doing this _now_ is to
allow for other packages to both be called by the terraform package _and_
work with provider schemas at the same time, without creating a package
dependency cycle: instead, these other packages can just import the
"providers" package and not need to import the "terraform" package at all.

For now this does still leave the responsibility for _building_ a
providers.Schemas object over in the "terraform" package, because it's
currently doing that as part of some larger work that isn't easily
separable, and so reorganizing that would be a more involved and riskier
change than just moving the existing type elsewhere.
2022-03-04 15:51:36 -05:00
Martin Atkins
2453025a1a addrs: Reference.DisplayString method
We've ended up implementing something approximately like this in a few
places now, so this is a centralized version that we can consolidate on
moving forward, gradually removing that duplication.
2022-03-04 15:51:36 -05:00
Barrett Clark
979ac3da44
Merge pull request #30602 from hashicorp/barrettclark/update-go-slug
Cloud: Update go-slug for terraform.tfstate exclusion
2022-03-02 11:02:23 -06:00
Barrett Clark
ecf76add75 Update go-slug for terraform.tfstate exclusion
`go-slug` has been updated to not upload `terraform.tfstate` to the slug
so that a user will no longer receive the error message about the
leftover state file after migrating from the local backend to TFC.
2022-03-02 10:12:18 -06:00
Alisdair McDiarmid
92747e3459
Merge pull request #30575 from hashicorp/alisdair/upgrade-deps
build: Upgrade `alibaba-cloud-sdk-go` and `winrmtest` dependencies
2022-03-01 17:02:29 -05:00
Alisdair McDiarmid
fe6ce539fa go get github.com/dylanmei/winrmtest 2022-03-01 16:52:48 -05:00
Alisdair McDiarmid
51a08c79a4 go get github.com/aliyun/alibaba-cloud-sdk-go/sdk 2022-03-01 16:52:17 -05:00
Sebastian Rivera
dc63fda44b Update CHANGELOG.md 2022-02-25 14:34:10 -08:00
Sebastian Rivera
afb956d745
Merge pull request #30141 from hashicorp/preapply-runtasks-clioutput
Cloud run tasks (post-plan only) CLI integration
2022-02-25 15:46:46 -05:00
Sebastian Rivera
52c5f9f6b7 Updated for latest go-tfe run task changes 2022-02-25 15:32:16 -05:00
Laura Pacilio
e8364b2505
Merge pull request #30580 from hashicorp/fix-broken-link
Fix broken link on provisioners connection page
2022-02-25 11:25:27 -05:00
Laura Pacilio
ad1ba5ef12 fix broken link on provisioners connection page 2022-02-24 18:15:05 -05:00
Craig Wright
195adc042a
Merge pull request #30574 from dhodun/doc_fix
[Docs] Added github.com commit reference example
2022-02-24 12:08:17 -08:00
Sebastian Rivera
126d6df088 Added run task support for post plan run stage, removed pre apply
This commit stems from the change to make post plan the default run task stage, at the
time of this commit's writing! Since pre apply is under internal revision, we have removed
the block that polls the pre apply stage until the team decides to re-add support for pre apply
run tasks.
2022-02-24 14:06:57 -05:00
uturunku1
542e3f901d run go mod tidy 2022-02-24 14:06:57 -05:00
uturunku1
383da4893b use new enum string for task stages 2022-02-24 14:06:57 -05:00
uturunku1
e46683d2c7 pull latest changes from go-tfe run-tasks-integration branch 2022-02-24 14:06:57 -05:00
Brandon Croft
aa0dda81b4 Fall back to reading latest run without task_stages
Older versions of TFE will not allow "task_stages" as an include parameter. In this case, fall back to reading the Run without additional options.
2022-02-24 14:06:57 -05:00
Brandon Croft
391b9c497c update go-tfe
go-tfe is pinned to branch run-tasks-integration pending API changes until run tasks support in the CLI is closer to release
2022-02-24 14:06:55 -05:00
uturunku1
46aaaa0a95 run go mod tidy 2022-02-24 14:03:27 -05:00
uturunku1
a9da859ee5 rename variables to something more descriptive 2022-02-24 14:03:02 -05:00
uturunku1
385589e1a4 run go mod tidy 2022-02-24 14:03:02 -05:00
uturunku1
77946af472 pull latest changes from go-tfe branch and use use new field name that previously was incorrectly named TaskStage 2022-02-24 14:03:00 -05:00
uturunku1
8090b23db7 delete unused function 2022-02-24 14:02:37 -05:00
Brandon Croft
0b8bb29a61 [cloud] refactor integration context and add code documentation 2022-02-24 14:02:37 -05:00
Brandon Croft
791c36c504 [cloud] report run tasks by name instead of assuming pre_apply 2022-02-24 14:02:37 -05:00
uturunku1
6b5da4d43c [cloud] run tasks output formatting 2022-02-24 14:02:37 -05:00
Brandon Croft
2938ec43fa [cloud] handle unreachable run tasks 2022-02-24 14:02:37 -05:00
uturunku1
3e9ae69a12 [cloud] run tasks integration
This change will await the completion of pre-apply run tasks if they
exist on a run and then report the results.

It also adds an abstraction when interacting with cloud integrations such
as policy checking and cost estimation that simplify and unify output,
although I did not go so far as to refactor those callers to use it yet.
2022-02-24 14:02:35 -05:00
kmoe
2393c48720
Update CHANGELOG.md 2022-02-23 11:59:01 +00:00
Alisdair McDiarmid
70db495d00
Merge pull request #30525 from nozaq/provider-config-default
jsonconfig: fix keys for default providers
2022-02-22 16:13:41 -05:00
Drew Hodun
a26b551d47 added github.com commit reference example 2022-02-22 11:09:22 -05:00
Alisdair McDiarmid
17492285f4
Merge pull request #30561 from hashicorp/alisdair/json-output-optimization
jsonplan: Improve performance for deep objects
2022-02-22 10:12:00 -05:00
Alisdair McDiarmid
3e4d6b252f jsonplan: Improve performance for deep objects
When calculating the unknown values for JSON plan output, we would
previously recursively call the `unknownAsBool` function on the current
sub-tree twice, if any values were unknown. This was wasteful, but not
noticeable for normal Terraform resource shapes.

However for deeper nested object values, such as Kubernetes manifests,
this was a severe performance problem, causing `terraform show -json` to
take several hours to render a plan.

This commit reuses the already calculated unknown value for the subtree,
and adds benchmark coverage to demonstrate the improvement.
2022-02-18 17:00:18 -05:00
nozaq
3c32f7a56c
jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
nozaq
0ce040405c
jsonconfig: fix provider mappings with same names 2022-02-19 00:44:48 +09:00
kmoe
161374725c
Warn when ignore_changes includes a Computed attribute (#30517)
* ignore_changes attributes must exist in schema

Add a test verifying that attempting to add a nonexistent attribute to
ignore_changes throws an error.

* ignore_changes cannot be used with Computed attrs

Return a warning if a Computed attribute is present in ignore_changes,
unless the attribute is also Optional.

ignore_changes on a non-Optional Computed attribute is a no-op, so the user
likely did not want to set this in config.
An Optional Computed attribute, however, is still subject to ignore_changes
behaviour, since it is possible to make changes in the configuration that
Terraform must ignore.
2022-02-18 10:38:29 +00:00
nozaq
7f4019e1f6
jsonconfig: fix keys for default providers
Fixes provider config keys to reflect implicit provider inheritance.
2022-02-16 01:38:57 +09:00
Laura Pacilio
68e70d71d4
Merge pull request #30483 from bpar476/patch-1
Adds documentation to `substr` function to cover when `length` exceeds input length
2022-02-15 11:27:47 -05:00
Ben Partridge
252865c6a0
Improvements to wording of substr function documentation
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-02-15 10:23:37 +11:00
Pedro Belém
aed7162e9a
cli: Fix state mv exit code for missing resource (#29839) 2022-02-14 15:20:03 -05:00
Alisdair McDiarmid
7a20c07cb0
Update CHANGELOG.md 2022-02-10 10:35:34 -05:00
Alisdair McDiarmid
d8018270a7
Merge pull request #30138 from hashicorp/alisdair/json-module-call-providers-mapping
jsonconfig: Improve provider configuration output
2022-02-10 10:33:47 -05:00
Alisdair McDiarmid
0a9503812d
Merge pull request #30476 from hashicorp/alisdair/fix-type-marks
cli: Prevent complex uses of the console-only `type` function
2022-02-10 10:23:07 -05:00
Alisdair McDiarmid
98f80bc5da website: Explain limitations of type function 2022-02-10 06:12:58 -05:00
Alisdair McDiarmid
843c50e8ce lang: Further limit the console-only type function
This commit introduces a capsule type, `TypeType`, which is used to
extricate type information from the console-only `type` function. In
combination with the `TypeType` mark, this allows us to restrict the use
of this function to top-level display of a value's type. Any other use
of `type()` will result in an error diagnostic.
2022-02-10 06:12:58 -05:00
Laura Pacilio
c5740baa77
Merge pull request #30503 from hashicorp/fix-workspace-name-docs
Clarify workspace.name expression
2022-02-09 17:47:13 -05:00
Alisdair McDiarmid
903d6f1055 lang: Remove use of marks.Raw in tests
These instances of marks.Raw usage were semantically only testing the
properties of combining multiple marks. Testing this with an arbitrary
value for the mark is just as valid and clearer.
2022-02-09 17:43:54 -05:00
Alisdair McDiarmid
691b98b612 cli: Prevent overuse of console-only type function
The console-only `type` function allows interrogation of any value's
type.  An implementation quirk is that we use a cty.Mark to allow the
console to display this type information without the usual HCL quoting.
For example:

> type("boop")
string

instead of:

> type("boop")
"string"

Because these marks can propagate when used in complex expressions,
using the type function as part of a complex expression could result in
this "print as raw" mark being attached to a collection. When this
happened, it would result in a crash when we tried to iterate over a
marked value.

The `type` function was never intended to be used in this way, which is
why its use is limited to the console command. Its purpose was as a
pseudo-builtin, used only at the top level to display the type of a
given value.

This commit goes some way to preventing the use of the `type` function
in complex expressions, by refusing to display any non-string value
which was marked by `type`, or contains a sub-value which was so marked.
2022-02-09 17:43:54 -05:00
Laura Pacilio
24cffb5ff3 Soften language for determining run environment 2022-02-09 17:41:12 -05:00