Commit Graph

31149 Commits

Author SHA1 Message Date
kmoe
b435b4ccde
cliconfig: more provider_installation err detail (#32722) 2023-02-21 18:18:57 +00:00
Sebastian Rivera
3f23a9e70a
Merge pull request #32696 from hashicorp/sebasslash/sro-provisioner-logs
Handle provisioner log types when rendering structured logs
2023-02-21 11:44:16 -05:00
Daniel Banck
b8f3f802f5
Add website docs for metadata functions -json command (#32701)
* Add metadata functions doc to internals

* Add metadata functions to internals nav

* Review feedback

* Renamed the doc
* Fixed small typos

* Update page title
2023-02-20 14:14:32 +00:00
Daniel Banck
f29156cdef
Replace HTML entities in function descriptions (#32710) 2023-02-20 14:11:06 +00:00
Mrinali Rao
afc9235f17
Update internal/cloud/backend_taskStages.go
Co-authored-by: Glenn Sarti <glennsarti@users.noreply.github.com>
2023-02-20 18:35:58 +11:00
mrinalirao
3104811c7d add test to see if override continues to poll on success 2023-02-20 17:50:25 +11:00
mrinalirao
190858b9e4 Bug Fix where CLI exits if run is not confirmable. 2023-02-20 17:18:13 +11:00
CJ Horton
25d8f26e41
Remove docs bundle from build workflow 2023-02-17 19:56:45 -08:00
Martin Atkins
6ab3faf5f6
Update CHANGELOG.md 2023-02-17 14:25:31 -08:00
Martin Atkins
c7aff57c92 build: Use Go 1.20.0
This changes which Go version we use for official releases and for
everyday development and testing.

At the time of this commit Go 1.20.1 is available but is not yet included
in goenv, the tool that we use in some environments for reacting
automatically to this file. I expect we'll upgrade to Go 1.20.1 very soon,
but this is a routine upgrade to the latest major release so that we can
start soaking in the new compiler and library behaviors throughout the
v1.5 development period.

Go 1.20 continues to support only Unicode 13, so we do not need to make
any changes to our supporting packages that also rely on Unicode data.
2023-02-17 14:24:52 -08:00
James Bardin
014a425d0e
Merge pull request #32683 from hashicorp/jbardin/import-terraform-data
allow terraform_data to import
2023-02-17 09:51:02 -05:00
Alisdair McDiarmid
cc6ea4abc2
Merge pull request #32678 from Jukie/go-getter-update
Update go-getter version
2023-02-17 07:04:36 -05:00
Sebastian Rivera
6d0a191ec4 Handle provisioner log types in renderer 2023-02-16 10:54:58 -05:00
CJ Horton
30f8b014f8 keep the friendly error message whenever possible 2023-02-15 21:40:46 -08:00
CJ Horton
727e22e762 add tests for init syntax error handling
With the demise of the early config loader, we want to show core
version errors first, followed by backend errors, and only then
show other errors with the configuration.
2023-02-15 21:01:27 -08:00
Middleton, Nathan
119f645b41 ECCEAT-1964 join function example added in documentation 2023-02-15 13:15:15 +00:00
Martin Atkins
71774c2a37
Update CHANGELOG.md 2023-02-14 15:22:18 -08:00
Martin Atkins
f0de9b60c1 backend/local: Periodically persist intermediate state snapshots
Terraform Core emits a hook event every time it writes a change into the
in-memory state. Previously the local backend would just copy that into
the transient storage of the state manager, but for most state storage
implementations that doesn't really do anything useful because it just
makes another copy of the state in memory.

We originally added this hook mechanism with the intent of making
Terraform _persist_ the state each time, but we backed that out after
finding that it was a bit too aggressive and was making the state snapshot
history much harder to use in storage systems that can preserve historical
snapshots.

However, sometimes Terraform gets killed mid-apply for whatever reason and
in our previous implementation that meant always losing that transient
state, forcing the user to edit the state manually (or use "import") to
recover a useful state.

In an attempt at finding a sweet spot between these extremes, here we
change the rule so that if an apply runs for longer than 20 seconds then
we'll try to persist the state to the backend in an update that arrives
at least 20 seconds after the first update, and then again for each
additional 20 second period as long as Terraform keeps announcing new
state snapshots.

This also introduces a special interruption mode where if the apply phase
gets interrupted by SIGINT (or equivalent) then the local backend will
try to persist the state immediately in anticipation of a
possibly-imminent SIGKILL, and will then immediately persist any
subsequent state update that arrives until the apply phase is complete.
After interruption Terraform will not start any new operations and will
instead just let any already-running operations run to completion, and so
this will persist the state once per resource instance that is able to
complete before being killed.

This does mean that now long-running applies will generate intermediate
state snapshots where they wouldn't before, but there should still be
considerably fewer snapshots than were created when we were persisting
for each individual state change. We can adjust the 20 second interval
in future commits if we find that this spot isn't as sweet as first
assumed.
2023-02-14 15:17:56 -08:00
James Bardin
47fd019dbb
Merge pull request #32492 from hashicorp/bflad/lifecycle-computed-behavior
docs: Explicitly mention Computed-only attribute behavior for Proposed New State
2023-02-14 15:43:11 -05:00
James Bardin
55acdc6b31
Merge pull request #32679 from hashicorp/jbardin/terraform-data-docs
initial terraform_data docs
2023-02-14 15:11:58 -05:00
James Bardin
5adea6d58e change provisioner example in terraform_data
The existing example is already covered in the "Provisioners Without a
Resource" section, so make this one slightly different by triggering a
local-exec on multiple resources.
2023-02-14 15:05:41 -05:00
James Bardin
0a25e40aeb updates from review 2023-02-14 14:50:50 -05:00
James Bardin
1d0fc1c6c8
Update website/docs/language/meta-arguments/lifecycle.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2023-02-14 14:11:19 -05:00
James Bardin
f35625820a
Update website/docs/language/resources/terraform-data.mdx
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2023-02-14 14:10:07 -05:00
James Bardin
df65d16022 replace null_resource with terraform_data
Replace references to null_resource with terraform_data, and link the
use of terraform_data from replace_triggered_by.
2023-02-14 09:48:10 -05:00
James Bardin
3b953d3bd8 allow terraform_data to import
The terraform provider was panicking on import, because it didn't
previously have a resource type which could be imported at all. Add a
stub import function for terraform_data as a placeholder to allow the
call to complete successfully. While there's no need to actually import
a terraform_data resource, users will inevitably use this to construct
examples of import actions for learning purposes or bug reports.

This still isn't very useful even for examples however, because the
state-only nature of the terraform_data resource type means that we
can't fill in the state from only the import ID. This means that any
value in `trigger_replace` or `input` will cause a change in the next
plan. Once configuration data is available during import we can extend
this to create a logical final state based on config.
2023-02-14 09:37:21 -05:00
Daniel Banck
4fa77727b5
Introduce metadata functions command (#32487)
* Add metadata functions command skeleton

* Export functions as JSON via cli command

* Add metadata command

* Add tests to jsonfunction package

* WIP: Add metadata functions test

* Change return_type & type in JSON to json.RawMessage

This enables easier deserialisation of types when parsing the JSON.

* Skip is_nullable when false

* Update cli docs with metadata command

* Use tfdiags to report function marshal errors

* Ignore map, list and type functions

* Test Marshal function with diags

* Test metadata functions command output

* Simplify type marshaling by using cty.Type

* Add static function signatures for can and try

* Update internal/command/jsonfunction/function_test.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

---------

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-02-14 14:08:47 +00:00
James Bardin
0328d116c5 initial terraform_data docs 2023-02-13 17:59:31 -05:00
Jukie
e2106907f5 Update go-getter version 2023-02-13 11:15:58 -07:00
yokomotod
a62f4f0763
sort modules.json for stable order (#32618) 2023-02-13 18:26:16 +01:00
Alisdair McDiarmid
b7042e818f
Merge pull request #32664 from hashicorp/alisdair/do-not-add-orphan-nodes-for-deposed-instances
Do not add orphan nodes for deposed instances
2023-02-13 09:50:48 -05:00
Alisdair McDiarmid
12d00e6571
Merge pull request #32663 from hashicorp/alisdair/read-resource-instance-state-nil-checks
Fix panic when planning orphaned deposed instances
2023-02-13 09:50:28 -05:00
Liam Cervante
d212a72d1d
structured run output: impose canonical ordering on jsonstate and jsonplan packages (#32649) 2023-02-13 15:40:17 +01:00
Liam Cervante
6a1a9928a2
[equivalence tests] Use the latest equivalence testing version when executing equivalence tests. (#32659) 2023-02-13 15:40:02 +01:00
Yin Luo
e9b066f514
Support assume role for cos backend (#32631)
* go get github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813@v1.0.588

* feat:support assume_role for COS backend

* update go.mod and go.sum

* change secret_id and secret_key from required to optional

* update cos doc

* update logic by comments

* rm sensitive info in log
2023-02-13 10:25:58 +01:00
Brandon Croft
26e85685d1
Merge pull request #32647 from hashicorp/TF-4390-backport-initial-remote-state-serial-fix
Begin cloud remote state with serial > 0
2023-02-10 15:35:37 -07:00
Sebastian Rivera
71dac9bf5e Add token field to cloud backend 2023-02-10 16:58:14 -05:00
Alisdair McDiarmid
7ecb0b8ffb Do not add orphan nodes for deposed instances
Resource instances with no current object in state should not have
orphan nodes added to the graph, as deposed objects are handled
separately. This was previously handled correctly for the non-expanded
case, but expanded resources were missing the appropriate check for a
current object.

Also update the comment in the non-expanded case to hopefully clarify
that we're checking for the presence of a current object, not the
absence of any deposed objects. An instance may have both a current
object and zero or more deposed objects in some circumstances, and if
so, we still want an orphan node to be added if the instance is not in
configuration.
2023-02-10 16:25:11 -05:00
Alisdair McDiarmid
8997e5b8c6 Fix panic when planning orphaned deposed instances 2023-02-10 15:31:21 -05:00
Middleton, Nathan
925abf1037 ECCEAT-1964 join function description changed in documentation 2023-02-10 16:45:56 +00:00
megan07
d7d8a2262c
Merge pull request #32557 from bharathkkb/gcs-backend-impersonate-envvar
Add a GCS backend specific env var for impersonation
2023-02-09 09:28:26 -06:00
Liam Cervante
74233ba7e0
Update CHANGELOG.md for v1.5.0 2023-02-09 13:48:26 +01:00
Liam Cervante
0d5533e189
Update main branch version to v1.5.0 2023-02-09 13:45:21 +01:00
Sebastian Rivera
de574ae6d4
Initial implementation of structured logging in cloud backend (#32504)
* Implementation of structured logging.

These are the changes that enable the cloud backend to consume
structured logs and make use of the new plan renderer. This will enable
CLI-driven runs to view the structured output in the Terraform Cloud UI.

* Cloud structured logging unit tests

* Remove deferred logs logic, fix minor issues

Color formatting fixes, log type stop lists, default behavior for logs
that are unknown

* Use service disco path in redacted plan url
2023-02-09 13:35:48 +01:00
Mike Antonelli
961829fa49
Update providers.mdx 2023-02-08 16:53:16 -06:00
Brandon Croft
de7304cacb
Begin cloud remote state with serial > 0 2023-02-08 14:43:57 -07:00
James Bardin
afcbff193b move CHANGELOG.md entry to v1.3 2023-02-08 11:41:42 -05:00
Liam Cervante
4fa7cd0a68
structured renderer: fix closing json tags when rendering with no symbols (#32642) 2023-02-08 16:47:12 +01:00
James Bardin
7ab4e6fe2d update CHANGELOG.md 2023-02-07 17:45:11 -05:00
James Bardin
1307317457
Merge pull request #32614 from yardbirdsax/fix/30670
make remote state initial behavior the same as local state
2023-02-07 17:43:28 -05:00