Commit Graph

482 Commits

Author SHA1 Message Date
CJ Horton
b705414d6b use newly released go-tfe 1.26.0 2023-05-30 17:25:23 -07:00
Martin Atkins
9f6a3ba701 build: Generate copyright headers automatically
HashiCorp legal now requires a copyright claim in a comment at the top of
every substantial file in this repository. If we don't add this ourselves
then a bot will open a PR to add missing entries, but that process adds
git history, pull request, and GitHub notification noise so instead we'll
deal with it proactively as part of our usual code generation steps.

This means that pull requests will fail their checks if there are any
files that lack copyright headers, so we can deal with those before we
merge rather than in a subsequent PR.
2023-05-30 08:21:40 -07:00
CJ Horton
cdce4c4a6d write generated config when using the cloud integration 2023-05-30 00:17:02 -07:00
CJ Horton
b88bae2ec4 tests for cloud backend config generation 2023-05-29 22:34:30 -07:00
Martin Atkins
1ef550e59a go.mod: go get github.com/zclconf/go-cty@v1.3.2 2023-05-24 13:44:03 -07:00
Martin Atkins
c046b846a7 go.mod: upgrade github.com/hashicorp/go-tfe for response header hooks 2023-05-23 15:25:48 -07:00
James Bardin
6c08c3e45e udpate go-cty 2023-05-19 13:37:10 -04:00
Sebastian Rivera
b23cfaefe8 Refactor SRO check to prevent duplicate plan output 2023-04-13 18:30:56 -04:00
Martin Atkins
9f827f57ae go.mod: Revert cty minor version v1.13 upgrade
We inadvertently incorporated the new minor release of cty into the 1.4
branch, and that's introduced some more refined handling of unknown values
that is too much of a change to introduce in a patch release.

Therefore this reverts back to the previous minor release for the v1.4
series, and then we'll separately get the main branch ready to work
correctly with the new cty before Terraform v1.5.

This reverts just the upgrade and the corresponding test changes from
#32775, while retaining the HCL upgrade and the new test case it
introduced for that bug it was trying to fix. That new test is still
passing so it seems that the cty upgrade is not crucial to that fix.
2023-03-16 11:48:41 -04:00
Liam Cervante
32f151f20b
Update HCL to handle type mismatches when applying defaults (#32775)
* add test reproducing terraform crash

* pull latest hcl

* add missing go.sum file

* also fix tests broken by go-cty update
2023-03-09 14:29:58 +01:00
Alisdair McDiarmid
5e83ccc1f9 Remove terraform-config-inspect 2023-03-06 09:14:28 -05:00
dependabot[bot]
cff7584a38 Bump golang.org/x/net from 0.5.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 16:31:19 -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
Jukie
e2106907f5 Update go-getter version 2023-02-13 11:15:58 -07: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
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
Brandon Croft
0cafe0dfdb
Merge pull request #32571 from hashicorp/TF-3527-detect-alias-localterraform-com-during-terraform-init
Add support for Terraform Enterprise generic hostname localterraform.com
2023-01-31 10:59:12 -07:00
Liam Cervante
24b88b7a72
Reverse the order of conversion/defaults, and update HCL with more flexible defaults package (#32454)
* Add failing test case for the given issue

* pause

* don't use local when sending PR for review

* go get github.com/hashicorp/hcl/v2@v2.16.0

* Update go.mod

---------

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2023-01-31 06:37:24 -05:00
Brandon Croft
2fe3a23094
Add generic hostname (localterraform.com) support to cloud backend
Aliases the backend hostname config as "localterraform.com" and duplicates any existing auth credentials during cloud backend configuration.
2023-01-30 17:21:24 -07:00
Sheridan C Rawlins
75e5ae27a2
[fixes 31700] Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert. (#31699)
* Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert.

* Fix style.

* Skip cert validation to be sure error is related to missing client cert; not untrusted server cert.

* Remove misplaced err check.

* Fix the size of test using http backend.

* Just for correctness, include all certs in the pem encoded cert - sometimes certs come with a chain of their signers.

* Adjusted names as recommended in PR comments.

* Adjusted names to be full-length and more descriptive.

* Added full-fledged testing with mTLS http server

* Fix goimports.

* Fix the names of the backend config.

* Exclusive lock for write and delete.

* Revert "Fix goimports."

This reverts commit 7d40f6099fbbb675fb2e25e35ee40aeafe3d0a22.

* goimports just for server test.

* Added the go:generation for the mock.

* Move the TLS configuration out to make it more readable - don't replace the HTTPClient as the retryablehttp already creates one - just configure its TLS.

* Just switch the client/data params - felt more natural this way.

* Update internal/backend/remote-state/http/backend.go

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

* Update internal/backend/remote-state/http/testdata/gencerts.sh

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

* Update internal/backend/remote-state/http/backend.go

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

* Update internal/backend/remote-state/http/backend.go

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

* Update internal/backend/remote-state/http/backend.go

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

* Update internal/backend/remote-state/http/backend.go

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

* the location of the file name is not sensitive.

* Added error if only one of client_certificate_pem and client_private_key_pem are set.

* Remove testify from test cases; use t.Error* for assert and t.Fatal* for require.

* Fixed import consistency

* Just use default openssl.

* Since file(...) is so trivial to use, changed the client cert, key, and ca cert to be the data.

See also https://github.com/hashicorp/terraform-provider-http/pull/211

Co-authored-by: Sheridan C Rawlins <scr@ouryahoo.com>
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-01-26 14:08:07 +00:00
Anna Winkler
3cc7e55465
Expand error when discovery document request fails (#32394)
* Expand error when discovery document request fails.
* Use error type from svchost library
* Use svchost v0.0.1
2023-01-24 15:19:12 -07:00
Brandon Croft
5ac03755e7
Merge pull request #32303 from mrinalirao/mr/policy-evaluation
Add policy evaluation task stage to the CLI
2023-01-17 14:47:23 -07:00
Martin Atkins
8253821e56 go get github.com/zclconf/go-cty-yaml@v1.0.3
This includes the fix for a bug in what Terraform calls the "yamldecode"
function, where it was not correctly handling any situation where the
decode result is a null value. It was previously returning an unknown
value in that case, whereas now it returns a null value as expected.
2022-11-29 17:45:45 -08:00
mrinalirao
d7c7f3689c refactor task results to run as a task stage 2022-11-29 11:57:51 +11:00
Jarrett Spiker
cebd5e3fce Upgrade go-tfe to 1.12.0 2022-11-21 14:54:07 -05:00
Sarah French
6fd3a8cdf4
go get cloud.google.com/go/storage@v1.28.0 (#32203)
* go get cloud.google.com/go/storage@v1.28.0

* go mod tidy

* Run `make generate` & `make protobuf` using go1.19.3
2022-11-21 13:14:55 +00:00
Jamie Finnigan
530c0d33e4
go.mod: go get -u github.com/mitchellh/cli 2022-11-15 09:05:52 -08:00
Liam Cervante
0c7fda1906
Update HCL and go-cty to fix optional and default attributes (#32178)
* Add test cases to verify all the default and optional issues are fixed

* actually commit all the tests

* update go-cty

* Update hcl
2022-11-10 14:00:16 +00:00
Liam Cervante
6521355ba5
Convert variable types before applying defaults (#32027)
* Convert variable types before applying defaults

* revert change to unrelated test

* Add another test case to verify behaviour

* update go-cty

* Update internal/terraform/eval_variable.go

Co-authored-by: alisdair <alisdair@users.noreply.github.com>

Co-authored-by: alisdair <alisdair@users.noreply.github.com>
2022-11-02 09:38:23 +01:00
Tom Bamford
ff68c8d129
Merge pull request #31966 from kschu91/feature/azure-generic-oidc
backend/azurerm: add support for generic OIDC authentication
2022-10-31 11:25:36 +00:00
Liam Cervante
ab8a3f7063
Update go-cty to latest version (#32033)
* Update go-cty to latest version

* go mod tidy
2022-10-18 17:06:10 +02:00
James Bardin
713421c3ab
Merge pull request #31908 from hashicorp/bump_net
go get -u golang.org/x/net
2022-10-18 09:44:59 -04:00
Brandon Croft
bc1436af53
Merge pull request #31821 from glennsarti/gs/TF-707-add-pre-apply
Add support for pre-apply task results in the cloud backend
2022-10-10 09:18:15 -06:00
Kevin Schu
bc07a54cfd Fix go.sum 2022-10-07 19:24:02 +02:00
Kevin Schu
5842950291 Added support for generic OIDC authentication (eg. Gitlab) and ensure documentation is more clear about it´s usage. oidc_request_url and oidc_request_token are meant to be used for Github Actions only. 2022-10-07 19:23:01 +02:00
Jamie Finnigan
f133b06dee go get -u golang.org/x/net 2022-09-29 17:28:33 -07:00
Alisdair McDiarmid
10ae444ee2 Upgrade HCL to fix optional attr default crash
Also add regression test coverage of the crash. This would occur when
objects with optional attributes had default values of different type
from the attribute type, and the objects were members of a collection.

For example:

list(object({
  a = optional(set(string), [])
}))

If this type constraint is applied to a variable value where one object
has a set(string) value for a, and the other object applies the empty
tuple default, Terraform would crash.
2022-09-23 10:34:54 -04:00
Glenn Sarti
fc7b6b7f15 Upgrade go-tfe to 1.10.0
This commit updates the go-tfe library to the latest version (1.10.0). This is needed by
later commits for the pre-apply task stage.
2022-09-20 16:18:19 +08:00
Alisdair McDiarmid
9d864c2430 Use upstreamed HCL typexpr package
The 2.14.0 release of HCL includes the typeexpr changes we tested here,
so now we can revert to using the HCL package and remove our fork.
2022-09-01 16:03:48 -04:00
James Bardin
522556534d
remove deprecated backends (#31711)
* remove deprecated backends

* remove backend docs

Remove references to deprecated backends from docs.
2022-08-31 10:17:07 +01:00
Megan Bang
de8bd5826f first part of code review comments 2022-08-30 17:01:44 -05:00
Megan Bang
b8f2f81cd6 update to warn if schemas aren't available 2022-08-26 14:17:37 -05:00
Martin Atkins
a6de221a22 go.mod: go get github.com/zclconf/go-cty@v1.11.0
This fixes a possible panic in what Terraform calls the "flatten" function
in situations where a user passes in a null value of a sequence type.
The function will now treat that the same as a null value of any other
type.
2022-08-22 11:10:08 -07:00
Glenn Sarti
b6a478b683 Update go-tfe to v1.7.0 2022-08-18 10:08:22 +08:00
Brandon Croft
15b938a0c8
Update to go-tfe v1.6.0 2022-07-25 13:50:57 -06:00
Anna Winkler
d72911a640 Save detailed type outputs to JSONStateOutputs 2022-07-22 10:28:20 -06:00
Radek Simko
7feef1c4aa
Use hashicorp/terraform-registry-address as a decoupled library (#28338)
* refactor: Use tfaddr for provider address parsing

* refactor: Use tfaddr for module address parsing

* deps: introduce hashicorp/terraform-registry-address
2022-07-08 14:46:29 +01:00
James Bardin
30369650a7
Merge pull request #31343 from hashicorp/jbardin/mock-replace
remove go.mod replacement of `github.com/golang/mock`
2022-07-06 13:49:38 -04:00
James Bardin
d61d3e9fd8 remove deprecated etcdv3 backend 2022-06-30 15:32:43 -04:00
Liam Cervante
d876e68e2d
Fail global required_version check if it contains any prerelease fields (#31331)
* Fail global required_version check if it contains any prerelease fields

* go mod tidy

* Improve required_version prerelease not supported error string

* Add prerelease version constraint unit tests

* Fix side-effects by populating global diags too soon
2022-06-30 09:58:28 +01:00
James Bardin
02c4ee4ed8 remove go.mod replacement of mock 2022-06-29 16:58:41 -04:00
James Bardin
799ab6c951 remove deprecated etcd backend
This allows us to remove the manual replace directives
github.com/dgrijalva/jwt-go and google.golang.org/grpc, so that we can
remove the CVE warnings and update the grpc packages.

While the etcdv3 backend is also marked as deprecated, the changes here
are done in a manner to keep that backend working for the time being.
2022-06-27 15:01:21 -04:00
Martin Atkins
4927d51224 go.mod: Upgrade to HCL v2.13.0 2022-06-23 13:52:23 -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
ba5f1795ab update go-getter@v1.6.2 2022-06-13 15:04:33 -04:00
Piggy
367a850989
Bump github.com/Netflix/go-expect (#31103) 2022-05-31 16:24:01 +01:00
kmoe
8f7e03b95b
deps: upgrade mitchellh/cli (#31160) 2022-05-31 16:12:56 +01:00
James Bardin
f24eb858c8 update go-getter 2022-05-25 09:19:46 -04:00
Georg Gadinger
590a91a40f update golang.org/x/crypto again
The version that was in use previously broke my runs with a nice `ssh:
handshake failed: agent unsupported algorithm "ssh-ed25519"` error.  I
took a further look into this, and saw that the change that broke ssh
for me was fixed in https://github.com/golang/crypto/commit/46612604a.
Yay!
2022-05-20 15:25:42 +02:00
James Bardin
8699b115a7 udpate x/crypto/ssh 2022-04-28 16:21:09 -04:00
Tom Bamford
807e7c0350
Update to go-azure-helpers v0.31.1 2022-04-27 19:27:30 +01:00
Martin Atkins
09ab872a6f build: go get github.com/hashicorp/hcl/v2@v2.12.0
This tagged release is a superset of the specific commit we had previously
selected, adding in just an improved error message for inconsistent result
types in a conditional expression.
2022-04-25 09:45:56 -07:00
kmoe
84e18f31bd
bump mitchellh/cli from 1.1.2 to 1.1.3 (#30914) 2022-04-25 12:06:12 +01:00
James Bardin
197359cc8f update hcl for IsJSONExpression 2022-04-20 09:17:10 -04:00
Martin Atkins
9210ce6cdd build: GitHub Actions "Quick Checks" workflow
This is intended to eventually replace the CircleCI-based checks we use
as part of the PR process in this repository. We're already using GitHub
Actions for various other processes in this repository, so this change is
motivated by consistency of having all of our automation running in the
same system and written in the same language.

This is not a complete replacement for our CircleCI workflow yet, and
probably won't ever be because the CircleCI workflow contains some steps
that are arguably redundant with other processes we follow elsewhere.
However, the CircleCI workflow remains for now and won't be removed until
we're satisfied that enough of it is replicated by this GitHub Actions
workflow.
2022-04-04 08:12:44 -07:00
Luces Huayhuaca
bdc7d8c0a1
Upgrade go-tfe dependency to use 1.0 version. It contains breaking changes, so we are updating method signatures, method names and the type of optional parameters, as needed. (#30626) 2022-03-23 13:58:47 -07: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
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
52c5f9f6b7 Updated for latest go-tfe run task changes 2022-02-25 15:32:16 -05:00
uturunku1
542e3f901d run go mod tidy 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
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
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
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
yuriy
d4ebed4c09 Updates from 'go mod tidy' 2022-01-17 23:08:39 +01:00
yuriy
08fb9078ea Update aws-sdk-go dependency to support new region (Jakarta) 2022-01-17 09:09:02 +01:00
Martin Atkins
74761b2f8b getmodules: Use go-getter v1.5.10 and return to upstream GitGetter
There was an unintended regression in go-getter v1.5.9's GitGetter which
caused us to temporarily fork that particular getter into Terraform to
expedite a fix. However, upstream v1.5.10 now includes a
functionally-equivalent fix and so we can heal that fork by upgrading.

We'd also neglected to update the Module Sources docs when upgrading to
go-getter v1.5.9 originally and so we were missing documentation about the
new "depth" argument to enable shadow cloning, which I've added
retroactively here along with documenting its restriction of only
supporting named refs.

This new go-getter release also introduces a new credentials-passing
method for the Google Cloud Storage getter, and so we must incorporate
that into the Terraform-level documentation about module sources.
2022-01-03 11:44:16 -08:00
Brandon Croft
ced4f5500c
update go-tfe to v0.21.0 2021-12-09 13:16:11 -07:00
James Bardin
09291295e2 update hcl@v2.11.1 2021-12-01 12:29:33 -05:00
James Bardin
5facaf8970 update hcl@v2.11.0 2021-12-01 08:42:01 -05:00
Krista LaFentres
2c29a05053 Fix go.mod issues by running go mod tidy -go=1.16 && go mod tidy -go=1.17 2021-11-18 15:00:03 -06:00
tombuildsstuff
0272249f47 go mod vendor/go mod tidy 2021-11-17 18:27:55 +01:00
tombuildsstuff
cf56f42328 dependencies: upgrading to v0.18.0 of github.com/hashicorp/go-azure-helpers 2021-11-17 18:23:54 +01:00
James Bardin
ac52f5135a update k8s packages from retracted module
Use the latest k8s.io packages from v0.21
2021-11-16 14:42:06 -05:00
Barrett Clark
5ef82ddd2f Cloud: fix e2e tests
- Fix tests and remove commented code
- Remove parallel for some flaky tests
- Add README
2021-11-11 14:37:21 -05:00
Brandon Croft
9441666d9a
Merge pull request #29903 from hashicorp/pull-mock-gotfe-changes
Pull changes made to mocks in go-tfe
2021-11-11 10:12:09 -07:00
Brandon Croft
051bf5df7e
update to go-tfe@tfc-integration 2021-11-11 09:57:23 -07:00
kmoe
64635edfb9
Merge pull request #29885 from hashicorp/kmoe/more-init-interrupts
command: make module installation interruptible
2021-11-11 12:37:49 +00:00
Katy Moe
7022876494
bump go-getter to v1.5.9 2021-11-11 12:28:16 +00:00
uturunku1
9ef9f97121 pull go tfe changes from main branch 2021-11-08 09:03:05 -08:00
James Bardin
ca6d3cf50f update go-cty
cty: The documented definition and comparison logic of cty.Number is now
refined to acknowledge that its true range is limited only to values
that have both a binary floating point and decimal representation,
because cty values are primarily designed to traverse JSON serialization
where numbers are always defined as decimal strings.

In particular, that means that two cty.Number values now always compare
as equal if their representation in JSON (under cty's own JSON encoder)
would be equal, even though the decimal approximation we use for that
conversion is slightly lossy. This pragmatic compromise avoids confusing
situations where a round-trip through JSON serialization (or other
serializations that use the same number format) may produce a value that
doesn't compare equal to the original.

This new definition of equals should not cause any significant behavior
change for any integer in our in-memory storage range, but may cause
some fractional values to compare equal where they didn't before if they
differ only by a small fraction.
2021-11-02 17:30:26 -04:00
James Bardin
81e709d185
Merge pull request #29825 from hashicorp/jbardin/no-panicwrap
Remove the use of panicwrap in the Terraform CLI
2021-10-29 14:41:05 -04:00
Chris Arcand
85f0bc6198 Update go-tfe to e52963e 2021-10-28 19:29:17 -05:00
Omar Ismail
dfb4609be2 Backend State Migration from cloud to cloud.
* Add test for tfc to tfc mgiration
* Fix old tests, and remove unused code.
2021-10-28 19:29:15 -05:00
Brandon Croft
0bae48bc01 update to tfc-integration branch of go-tfe 2021-10-28 19:29:13 -05:00
Omar Ismail
dd856f8a1b Add run variables to cloud plan operations from non-file sources
Run variables allow the run API to accept input variables not found
in the configuration slug (the file-based ones plus workspace vars)
2021-10-28 19:29:12 -05:00
Omar Ismail
55fc590904 Teraform Cloud Backend State Migration
* determining source or destination to cloud
* handling single to single state migrations to cloud,
using a name strategy or a tags strategy
* Add end-to-end tests for state migration.
2021-10-28 19:29:12 -05:00