Commit Graph

30210 Commits

Author SHA1 Message Date
Dirk Leser
ab93ef09ec
Readded the new example below the description 2022-06-17 14:42:52 +02:00
Dirk Leser
37d18f4229
functions/merge: Added expanation for example
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-06-17 14:32:02 +02:00
Laura Pacilio
66f6bb50ac
Merge pull request #30275 from Mukesh05/patch-1
Update purpose.mdx
2022-06-16 13:34:46 -04:00
Nicolas Vanheuverzwijn
bb1c134b94 http-backend: http backend lock error return LockError instead of generic error 2022-06-16 11:01:01 -04:00
Martin Atkins
dc5964f8a3 refactoring: Use addrs.Map for maps with addresses as keys
We introduced the addrs.UniqueKey and addrs.UniqueKeyer mechanics as part
of implementing the ValidateMoves and ApplyMoves functions, as a way to
better encapsulate the solution to the problem that lots of our address
types aren't comparable and so cannot be used directly as map keys.

However, exposing addrs.UniqueKey handling directly in the logic adds
various noise to the algorithms and, in particular, obscures the fact that
MoveResults.Changes and MoveResult.Blocked both have different map key
types.

Here then we'll use the new addrs.Map helper type, which encapsulates the
idea of a map from an addrs.UniqueKeyer type to an arbitrary value type,
using the unique keys as the map keys internally. This does unfortunately
mean that we lose the conventional Go map access syntax and have to use
a method-based API instead, but I (subjectively) think that's an okay
compromise in return for avoiding the need to keep track inline of which
addrs.UniqueKey values correspond with which real addresses.

This is intended as an entirely-mechanical change, with equivalent
behavior to what it replaced. If anything here is doing something
materially different than what it replaced then that's a mistake.
2022-06-16 07:03:36 -07:00
Martin Atkins
eb2374070f addrs: Generic types for maps and sets of addresses
The addrs.Set type previously snuck in accidentally as part of the work
to add addrs.UniqueKey and addrs.UniqueKeyer, because without support for
generic types the addrs.Set type was a bit of a safety hazard due to not
being able to enforce particular address types at compile time.

However, with Go 1.18 adding support for type parameters we can now turn
addrs.Set into a generic type over any specific addrs.UniqueKeyer type,
and complement it with an addrs.Map type which supports addrs.UniqueKeyer
keys as a way to encapsulate the handling of maps with UniqueKey keys that
we currently do inline in various other parts of Terraform.

This doesn't yet introduce any callers of these types, but we'll convert
existing users of addrs.UniqueKeyer gradually in subsequent commits.
2022-06-16 07:03:36 -07:00
Martin Atkins
7b3e6b32d4 go.mod: Now targeting the Go 1.18 language
This means we can now use type parameter syntax where appropriate.

This commit also includes an upgrade to the golang.org/x/tools module,
in order to get a newer version of "stringer" that supports the type
parameters syntax.
2022-06-16 07:03:36 -07:00
James Bardin
0d3d95486a
Merge pull request #31218 from hashicorp/jbardin/validate-provider-local-names
Validate duplicate provider local names in `required_providers`
2022-06-15 13:51:38 -04:00
James Bardin
57c0deb01e check for duplicate defaults from resource names 2022-06-15 13:32:30 -04:00
James Bardin
9db277af42
Merge pull request #31246 from hashicorp/jbardin/copy-deps-for-comparison
copy dependency values when sorting
2022-06-14 12:44:58 -04:00
James Bardin
e7e3d80850
Merge pull request #31223 from Kagashino/fix/cos-backend-unlock-tag
Backend/COS: remove COS object lock tag either when unlock remote state
2022-06-14 12:21:01 -04:00
James Bardin
f1ce3edcc5 copy dependency values when sorting
Expanded resource instances can initially share the same dependency
slice, so we must take care to not modify the array values when
checking the dependencies.

In the future we can convert these to a generic Set data type, as we
often need to compare for equality and take the union of multiple groups
of dependencies.
2022-06-14 11:09:27 -04:00
Laura Pacilio
cbf86e0181
Merge pull request #31240 from hashicorp/add-internals-to-sidebar
Add internals to the sidebar
2022-06-14 10:55:57 -04:00
Laura Pacilio
2e4b417e3c Add internals to the sidebar 2022-06-13 17:30:11 -04:00
Craig Wright
0db75574fc
Merge pull request #31227 from pyaillet/patch-1
Fix a wrong usage of sudo in debian install doc
2022-06-13 14:04:47 -07:00
James Bardin
b6ddb087e1
Merge pull request #31237 from hashicorp/jbardin/update-go-getter
update go-getter@v1.6.2
2022-06-13 15:21:40 -04:00
James Bardin
ba5f1795ab update go-getter@v1.6.2 2022-06-13 15:04:33 -04:00
Alisdair McDiarmid
9497b2cd6f json-output: Fix unknowns for tuples and sets
The JSON output for sequences previously omitted unknown values for
tuples and sets, which made it impossible to interpret the corresponding
unknown marks. For example, consider this resource:

    resource "example_resource" "example" {
      tags = toset(["alpha", timestamp(), "charlie"])
    }

This would previously be encoded in JSON as:

    "after": {
        "tags": ["alpha", "charlie"]
    },
    "after_unknown": {
        "id": true,
        "tags": [false, true, false]
    },

That is, the timestamp value would be omitted from the output
altogether, while the corresponding unknown marks would include a value
for each of the set members.

This commit changes the behaviour to:

    "after": {
        "tags": ["alpha", null, "charlie"]
    },
    "after_unknown": {
        "id": true,
        "tags": [false, true, false]
    },

This aligns tuples and sets with the prior behaviour for lists, and
makes it clear which elements are known and which are unknown.
2022-06-13 14:33:40 -04:00
Alisdair McDiarmid
48d64eabb2 json-output: Extended detail for unknown outputs
Planned output changes are represented in the JSON output format using
the same change object as planned resource changes. This structure
includes an `after` value and a parallel `after_unknown` value, which
can be combined to determine which specific parts of a value are known
only at apply time.

Previously, structured output values would be marked in the JSON plan as
coarsely known or unknown, even if only some subset of the structure
will be known only at apply time. This simplification was unnecessary,
and this commit reuses the same logic for resource changes to give more
information to consumers of this format.

For example, consider this output:

    output "bar" {
      value = tolist([
        "hello",
        timestamp(),
        "world",
      ])
    }

The plan output for this output would be:

    + bar = [
        + "hello",
        + (known after apply),
        + "world",
      ]

For the same plan, the JSON output was previously:

    "bar": {
      "actions": [
        "create"
      ],
      "before": null,
      "after_unknown": true,
      "before_sensitive": false,
      "after_sensitive": false
    }

After this commit, the output is instead:

    "bar": {
      "actions": [
        "create"
      ],
      "before": null,
      "after": [
        "hello",
        null,
        "world"
      ],
      "after_unknown": [
        false,
        true,
        false
      ],
      "before_sensitive": false,
      "after_sensitive": false
    }
2022-06-13 14:06:03 -04:00
Alisdair McDiarmid
922de89be1 Conclude module variable optional attrs experiment 2022-06-13 12:27:21 -04:00
Laura Pacilio
f6752c6cfa
Merge pull request #31204 from parkchoongho/patch-1
Update syntax.mdx
2022-06-13 11:20:41 -04:00
Laura Pacilio
5c43afcb0e
Merge pull request #31213 from hashicorp/add-warnings-backends
Revise Backends Config Page
2022-06-13 11:05:51 -04:00
James Bardin
256b113990
Merge pull request #31176 from hashicorp/jbardin/plan-destroy-configure-provider
Configure providers during a destroy plan
2022-06-13 09:05:24 -04:00
Park Choong Ho
7510dc4d47
Update website/docs/language/resources/syntax.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-06-13 17:21:37 +09:00
Pierre-Yves Aillet
2fd3da94c7
Fix a wrong usage of sudo in debian install doc
Currently `sudo` is applied to `echo` resulting in:
`/etc/apt/sources.list.d/terraform.list: Permission denied`

Using `echo "..." | sudo tee /etc/apt/sources.list.d/terraform.list` fix the problem
2022-06-11 16:04:10 +02:00
James Bardin
d7238d510a skip already added provider nodes
We can skip providers which already have a node in the graph for their
type.
2022-06-10 10:37:58 -04:00
James Bardin
2581bc93cb Check for duplicate types in required_providers
Adding multiple local names for the same provider type in
required_providers was not prevented, which can lead to ambiguous
behavior in Terraform. Providers are always indexed by the providers
fully qualified name, so duplicate local names cannot be differentiated.
2022-06-10 10:37:21 -04:00
Kagashino
cab6cee385 fix: backend/cos - remove cos object write lock either when unlock state file 2022-06-10 20:14:58 +08:00
Laura Pacilio
c4d7207230
Merge pull request #31191 from IgnacioNMiranda/patch-1
docs: update depends_on.mdx meta-argument
2022-06-09 16:37:32 -04:00
Laura Pacilio
fa76c1dcf0 apply suggestions from PR review 2022-06-09 14:55:12 -04:00
Martin Atkins
543e5f4971 docs: "Resource Instance Change Lifecycle" revised
The previous version of this document was produced in haste in order to
support the development of the new provider framework, and so it focused
only on the most important details and left some of the operations totally
unmentioned.

This new version aims to capture the full set of managed-resource-related
provider operations, documenting when Terraform Core will call them and
what the provider ought to do in order to meet Terraform Core's
expectations for a valid response.

This new version does still assume a certain amount of knowledge on the
part of the reader about broadly what Terraform does from a user
perspective and what role providers play in that process. Perhaps a future
revision will include some additional background context as well, but
this is a snapshot of what I had time to do today between other work and
so for now I focused on presenting the remaining operations in a similar
amount of detail to what was here before.
2022-06-09 10:19:43 -07:00
James Bardin
b4ff641a47
Merge pull request #31215 from hashicorp/jbardin/deprecate-backends
deprecate unmaintained remote state backends
2022-06-09 10:06:04 -04:00
James Bardin
0c7d39aca5 deprecate unmaintained backends 2022-06-08 18:09:25 -04:00
Laura Pacilio
f775e70e80
Update website/README.md 2022-06-08 17:45:49 -04:00
Laura Pacilio
8a5d981084
Merge branch 'main' into laura-update-docs-readme 2022-06-08 17:44:42 -04:00
Laura Pacilio
401e28c7c2
Update README.md 2022-06-08 17:41:49 -04:00
Laura Pacilio
a20e1609c6
Update README.md 2022-06-08 17:41:26 -04:00
Laura Pacilio
1f40a886fe Update readme 2022-06-08 17:40:33 -04:00
Laura Pacilio
53d0661785 Add warning note to each backend page 2022-06-08 16:32:01 -04:00
Laura Pacilio
89dbd6a26b Remove overview backends page; add sensitive credentials warning to config page 2022-06-08 16:17:27 -04:00
hc-github-team-tf-core
2f1a8bbbd8 Cleanup after v1.3.0-alpha20220608 release 2022-06-08 17:31:07 +00:00
hc-github-team-tf-core
da14009ef0
Release v1.3.0-alpha20220608 2022-06-08 17:15:04 +00:00
Laura Pacilio
29435b46ac Edit type constraints docs for style and flow 2022-06-08 12:40:29 -04:00
Laura Pacilio
5bfd746696
Merge pull request #31198 from hashicorp/add-format-function-guidance
Add guidance about using the format function
2022-06-08 11:08:53 -04:00
Park Choong Ho
3513352300
Update syntax.mdx
fix wrong grammar
2022-06-08 18:37:56 +09:00
Laura Pacilio
6aa960c239
Update website/docs/language/expressions/custom-conditions.mdx 2022-06-07 17:09:42 -04:00
Laura Pacilio
9b57fc2964 Add guidance about using the format function 2022-06-07 16:44:25 -04:00
Laura Pacilio
e5658c2478 Explain the the destroy mode is the same as running terraform destroy 2022-06-07 15:27:00 -04:00
Laura Pacilio
3c2685222e Update apply page for style, concision, and clarity 2022-06-07 15:21:40 -04:00
Laura Pacilio
41659a776e
Merge pull request #31185 from paullschock/patch-2
Add details reg. verbosity of debug log level (replace #29641)
2022-06-06 12:25:10 -04:00