Commit graph

70 commits

Author SHA1 Message Date
Sarah French
2e5b5dee5d
Upgrade protoc and protoc-gen-go-grpc versions to matching terraform-plugin-go (#37647)
Some checks failed
build / Build for freebsd_amd64 (push) Has been cancelled
build / Build for linux_amd64 (push) Has been cancelled
build / Build for openbsd_amd64 (push) Has been cancelled
build / Build for solaris_amd64 (push) Has been cancelled
build / Build for windows_amd64 (push) Has been cancelled
build / Build for freebsd_arm (push) Has been cancelled
build / Build for linux_arm (push) Has been cancelled
build / Build for darwin_arm64 (push) Has been cancelled
build / Build for linux_arm64 (push) Has been cancelled
build / Build for windows_arm64 (push) Has been cancelled
build / Build Docker image for linux_386 (push) Has been cancelled
build / Build Docker image for linux_amd64 (push) Has been cancelled
build / Build Docker image for linux_arm (push) Has been cancelled
build / Build Docker image for linux_arm64 (push) Has been cancelled
build / Build e2etest for linux_386 (push) Has been cancelled
build / Build e2etest for windows_386 (push) Has been cancelled
build / Build e2etest for darwin_amd64 (push) Has been cancelled
build / Build e2etest for linux_amd64 (push) Has been cancelled
build / Build e2etest for windows_amd64 (push) Has been cancelled
build / Build e2etest for linux_arm (push) Has been cancelled
build / Build e2etest for darwin_arm64 (push) Has been cancelled
build / Build e2etest for linux_arm64 (push) Has been cancelled
build / Run e2e test for linux_386 (push) Has been cancelled
build / Run e2e test for windows_386 (push) Has been cancelled
build / Run e2e test for darwin_amd64 (push) Has been cancelled
build / Run e2e test for linux_amd64 (push) Has been cancelled
build / Run e2e test for windows_amd64 (push) Has been cancelled
build / Run e2e test for linux_arm (push) Has been cancelled
build / Run e2e test for linux_arm64 (push) Has been cancelled
build / Run terraform-exec test for linux amd64 (push) Has been cancelled
* Update protoc version in downloader script

* go get google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1

This matched terraform-plugin-go

* make protobuf

* Run `make protobuf`

* Update generator to handle generic types from google.golang.org/grpc

Looks like this was added in v1.69.3 in https://github.com/grpc/grpc-go/pull/7057 ?

* Run `make generate`

* Fix "cannot infer Res" compile error - more usage of generics

* More fixing compile errors due to switching to use of a generic

* Make putting `google.golang.org/grpc` import into generated files conditional

* Run `make generate`

* Update more places where generics now need to be used

* Update generator to handle any types from google.golang.org/grpc in same switch case.
2025-10-22 14:46:18 +01:00
Sarah French
2657a4daec
Set let require_unimplemented_servers default to true when generating code from .proto files (#37737)
* Remove `require_unimplemented_servers=false` option when generating code from proto files. Run `make protobuf`.

This allows require_unimplemented_servers to default to true, and the generated code shows the impacts of that.

* Update generator script to embed 'UnimplementedFoobarServer' structs and skip generating code for the `mustEmbedUnimplementedFoobarServer` method that is implemented via that embedding.

* Run `make generate`

* Embed UnimplementedProviderServer into implementations of ProviderServer

* Embed UnimplementedProvisionerServer into implementations of ProvisionerServer
2025-10-09 11:18:13 +01:00
Sarah French
ffbb62b369
Swap to using google.golang.org/protobuf/cmd/protoc-gen-go instead of github.com/golang/protobuf/protoc-gen-go (#37685)
* Reformat Args in steps definitions

* Swap to using the new version of protoc-gen-go that doesn't include grpc support (instead it relies on protoc-gen-go-grpc).

Update command flags to reflect this change in tooling.

See this comment for explanation: https://github.com/golang/protobuf/issues/1070#issuecomment-607293496

* Run `make protobuf` with problem generate steps commented out.

* Use `require_unimplemented_servers=false` to minimise changes at the time of upgrading tooling

In future we can navigate the consequences of this in its own PR.

* WIP

* Fix out/opt typo, add remaining flags once terraform1.proto was being found ok

* Run `make protobuf`

* `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0` && `go mod tidy`

This version includes a feature that allows the copyright comment in the .proto file to be pulled across to generated _grpc.pb.go files.

* Run `make protobuf` with new version of protoc-gen-go-grpc that allows copyright comment to be copied to generated output files

* Potential fix for `internal/rpcapi/dynrpcserver/generator`
2025-09-30 11:52:24 +01:00
Sarah French
c0547e784f
Fixes to protobuf compile script (#37683)
* Fix lack of protoc-gen-go-grpc

This appears to have been removed in https://github.com/hashicorp/terraform/pull/29492/files#diff-0329966ed7ce7286cfaf91161ac003af419cc566dd6420bb07670f9e4a389c81 accidentally following linting?

* Fix Args to include all arguments

The docs say "Args holds command line arguments, including the command as Args[0]."

* Add TODO for swapping to non-deprecated repo for protoc-gen-go
2025-09-26 18:08:19 +01:00
UKEME BASSEY
3bc13593f9 add proto files gen for stacks plugin, & regenerate protofiles
add tests

update changelog
2025-05-05 16:06:49 -04:00
Sarah French
371e625ea9
Update URLs from www.terraform.io to developer.hashicorp.com (#36792)
* Update URLs from www.terraform.io to developer.hashicorp.com

* More updates to URLs linking to documentation in documentation and user-facing warnings/errors

* More updates to URLs linking to documentation, in docs, code, test fixtures

* Replace www.terraform.io/community with link to Community Forum

* Apply suggestions from code review

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>

---------

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>
2025-04-01 09:37:12 +01:00
Jeff Bonhag
8b2941455a
Upgrade go-tfe from 1.51.0 to 1.58.0 (#35495)
* go get github.com/hashicorp/go-tfe@v1.58.0

* Switch to go.uber.org/mock for mocks
2024-08-08 11:31:49 +02:00
Liam Cervante
915b174da3
stacks: split the terraform1 RPC package into per-service packages (#35513)
* stacks: split the terraform1 RPC package into per-service packages

* pull latest changes
2024-08-07 17:33:51 +02:00
Sebastian Rivera
015f795ff0 Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
Rose
1b5966dd50 Small TFC fixes in md files 2024-04-19 06:58:43 -07:00
Martin Atkins
f9317731e9 tfstackdata1: Protobuf schema for stack plan and state serialization
This represents our _internal_ plan and state formats, which are private
to Terraform Core so that we can evolve them over time without needing to
coordinate with other systems.

The plan parts of this are the stack-specific container messages around
the existing "tfplan" proto schema that traditional Terraform uses for
saved plan files.

The state parts of this are really just stubs since we're not really
dealing with state just yet, but they're here to illustrate where we
intend to expand in future commits when we start implementing the apply
phase and the ability to plan based on a prior state.
2023-11-15 12:38:52 -08:00
Martin Atkins
9942deded1 plans: Move "planproto" up to toplevel
The Go package containing the generated stubs for the plan file format's
protobuf messages was previously nestled as an internal package under
"plans", making it importable only for source files under "plans".

To avoid duplicating various message types into the new "stack plan"
serialization, we'll now make this package internal to the whole of
this codebase rather than just to "plans", and then have the stack data
protocol buffers schema import it to reuse the same message types.
2023-11-15 12:38:51 -08:00
Martin Atkins
8f9b085501 rpcapi: Initial protobuf definition
This includes only the Setup service and some initial parts of the
Dependencies service, so we can focus on getting the infrastructure in
place before we worry too much about the actual implementations of the
services.
2023-11-15 12:38:50 -08:00
hashicorp-copywrite[bot]
53c34ff49c
Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
Brandon Croft
7111fd1170
Adds cloudproto1 to make protobuf 2023-07-25 09:28:31 -06:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00: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
Alisdair McDiarmid
e09bad76ff build: Add exhaustive switch statement lint
For now, only check the JSON views package, since this was the instance
that most recently tripped us up. There are a few dozen failures
elsewhere in Terraform which would need to be addressed before expanding
this to other packages.
2021-09-24 15:12:44 -04:00
James Bardin
863963e7a6 de-linting 2021-09-01 11:36:21 -04:00
James Bardin
5eb7170f70 add staticcheck to tools 2021-08-31 17:58:40 -04:00
Martin Atkins
ce96d82de0 build: Centralize our protobuf compilation steps
We have a few different .proto files in this repository that all need to
get recompiled into .pb.go files each time we change them, but we were
previously handling that with some scripts that just assumed that protoc
and the relevant plugins were already installed on the system somewhere,
at the right versions.

In practice we've been constantly flopping between different versions of
these tools due to folks having different versions installed in their
development environments. In particular, the state of the .pb.go files
in the prior commit wasn't reproducible by any single version of the tools
because they've all slightly diverged from one another.

In the interests of being more consistent here and avoiding accidental
inconsistencies, we'll now centralize the protocol buffer compile steps
all into a single tool that knows how to fetch and install the expected
versions of the various tools we need and then run those tools with the
right options to get a stable result.

If we want to upgrade to either a newer protoc or a newer protoc-gen-go
in future then we'll do that in a central location and update all of the
.pb.go files at the same time, so that we're always consistently tracking
the same version of protocol buffers everywhere.

While doing this I attempted to keep as close as possible to the toolchain
we'd most recently used, but since they were not consistent with each
other they've now all changed which version numbers they record at minimum,
and the planproto stub in particular now also has a slightly different
descriptor serialization but is otherwise offering the same API.
2021-08-20 16:18:48 -07:00
Martin Atkins
383bbdeebc Upgrade to Go 1.17
This includes the addition of the new "//go:build" comment form in addition
to the legacy "// +build" notation, as produced by gofmt to ensure
consistent behavior between Go versions. The new directives are all
equivalent to what was present before, so there's no change in behavior.

Go 1.17 continues to use the Unicode 13 tables as in Go 1.16, so this
upgrade does not require also upgrading our Unicode-related dependencies.

This upgrade includes the following breaking changes which will also
appear as breaking changes for Terraform users, but that are consistent
with the Terraform v1.0 compatibility promises.

- On MacOS, Terraform now requires macOS 10.13 High Sierra or later.

This upgrade also includes the following breaking changes which will
appear as breaking changes for Terraform users that are inconsistent with
our compatibility promises, but have justified exceptions as follows:

- cidrsubnet, cidrhost, and cidrnetmask will now reject IPv4 CIDR
  addresses whose decimal components have leading zeros, where previously
  they would just silently ignore those leading zeros.

  This is a security-motivated exception to our compatibility promises,
  because some external systems interpret zero-prefixed octets as octal
  numbers rather than decimal, and thus the previous lenient parsing could
  lead to a different interpretation of the address between systems, and
  thus potentially allow bypassing policy when configuring firewall rules
  etc.

This upgrade also includes the following breaking changes which could
_potentially_ appear as breaking changes for Terraform users, but that do
not in practice for the reasons given:

- The Go net/url package no longer allows query strings with pairs
  separated by semicolons instead of ampersands. This primarily affects
  HTTP servers written in Go, and Terraform includes a special temporary
  HTTP server as part of its implementation of OAuth for "terraform login",
  but that server only needs to accept URLs created by Terraform itself
  and Terraform does not generate any URLs that would be rejected.
2021-08-17 15:20:05 -07:00
Martin Atkins
8617d0fed0
An extra note about terraform-bundle with Terraform Enterprise 2021-06-10 11:24:06 -07:00
Martin Atkins
1b5456f144
A more elaborate README for removed terraform-bundle 2021-06-10 11:22:10 -07:00
Kristin Laemmert
5a48530f47
tools: remove terraform-bundle. (#28876)
* tools: remove terraform-bundle.

terraform-bundle is no longer supported in the main branch of terraform. Users can build terraform-bundle from terraform tagged v0.15 and older.

* add a README pointing users to the v0.15 branch
2021-06-03 14:08:04 -04:00
Martin Atkins
b40a4fb741 Move plugin/ and plugin6/ to internal/plugin{,6}/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
b9a93a0fe7 Move addrs/ to internal/addrs/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
05caff2ca3 Move tfdiags/ to internal/tfdiags/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
4c254cc2be Move httpclient/ to internal/httpclient/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
415ab31db8 Move e2e/ to internal/e2e/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Kristin Laemmert
125e9d69d4
terraform-bundle: return an error if "versions" argument is omitted (#28158) 2021-03-22 10:51:03 -04:00
Alex Chan
4ec80fa18d Correct the spelling of heirarchy/hierarchy throughout 2021-02-05 15:07:04 +00:00
Robert
c412935d63
correct terraform-bundle default plugins dir docs (#26965)
* correct terraform-bundle default plugins dir docs

* remove dangling character in local plugin dir log output
2020-12-15 13:52:31 -05:00
Pam Selle
b963ea8594 Update docs and add warning for -get-plugins
As of Terraform 0.13+, the get-plugins command has been
superceded by new provider installation mechanisms, and
general philosophy (providers are always installed, but
the sources may be customized). Updat the init command
to give users a warning if they are setting this flag,
to encourage them to remove it from their workflow, and
update relevant docs and docstrings as well
2020-12-07 14:13:52 -05:00
Martin Atkins
b3f5c7f1e6 command/init: Read, respect, and update provider dependency locks
This changes the approach used by the provider installer to remember
between runs which selections it has previously made, using the lock file
format implemented in internal/depsfile.

This means that version constraints in the configuration are considered
only for providers we've not seen before or when -upgrade mode is active.
2020-10-09 09:26:23 -07:00
Kristin Laemmert
f636a90e67
Update CHANGELOG.md 2020-09-28 10:34:25 -04:00
Chanh Hua
6d4e02ee42 Fix passing wrong file info & Add test coverage 2020-09-28 09:48:51 -04:00
Kristin Laemmert
8a75a4fc7b
terraform-bundle: initial changelog (#25917) 2020-08-19 15:20:07 -04:00
Kristin Laemmert
a8d9809234
terraform-bundle: re-enable e2e tests (#25516) 2020-08-10 15:17:47 -04:00
Matthew Sanabria
a943c943cf Syntax updates
It's easier to read inline monospace characters than quoted characters,
especially when the content itself refers to a file or directory name.
2020-07-22 11:05:33 -04:00
Lars Lehtonen
3d6a321d59
tools/terraform-bundle: fix dropped error (#25475) 2020-07-06 14:30:36 -04:00
Alvin Huang
54fb4b63bf gofmt tools/tools.go 2020-06-17 11:04:43 -04:00
Alvin Huang
7a471c0da7 adding gox to tools package 2020-06-17 10:59:28 -04:00
Kristin Laemmert
a43f141f9e
tools/terraform-bundle: refactor to use new provider installer and provider directory layouts (#24629)
* tools/terraform-bundle: refactor to use new provider installer and
provider directory layouts

terraform-bundle now supports a "source" attribute for providers,
uses the new provider installer, and the archive it creates preserves
the new (required) directory hierarchy for providers, under a "plugins"
directory.

This is a breaking change in many ways: source is required for any
non-HashiCorp provider, locally-installed providers must be given a
source (can be arbitrary, see docs) and placed in the expected directory
hierarchy, and the unzipped archive is no longer flat; there is a new
"plugins" directory created with providers in the new directory layout.

This PR also extends the existing test to check the contents of the zip
file.

TODO: Re-enable e2e tests (currently suppressed with a t.Skip)
This commit includes an update to our travis configuration, so the terraform-bundle e2e tests run. It also turns off the e2e tests, which will fail until we have a terraform 0.13.* release under releases.hashicorp.com. We decided it was better to merge this now instead of waiting when we started seeing issues opened from users who built terraform-bundle from 0.13 and found it didn't work with 0.12 - better that they get an immediate error message from the binary directing them to build from the appropriate release.
2020-04-21 17:09:29 -04:00
Kristin Laemmert
8c6ae66494 terraform-bundle: fix panic with addrs.Provider
Fixes #23652
2019-12-12 09:14:38 -05:00
Kristin Laemmert
9891d0354a
providers: use addrs.Provider as map keys for provider.Factory (#23548)
* terraform/context: use new addrs.Provider as map key in provider factories
* added NewLegacyProviderType and LegacyString funcs to make it explicit that these are temporary placeholders

This PR introduces a new concept, provider fully-qualified name (FQN), encapsulated by the `addrs.Provider` struct.
2019-12-04 11:30:20 -05:00
Kristin Laemmert
6728e521c1
addrs: rename Provider Name to more accurate Provider Type (#23449) 2019-12-02 15:32:31 -05:00
Radek Simko
7860f55e4f
Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
Kristin Laemmert
d7ed4b0605 tools/terraform-bundle: update e2e tests with current tf and provider
versions

The terraform version was hard-coded to 0.10.2, and the provider
versions supported the older provider protocol version 4.
2019-09-25 14:55:26 -04:00
Kristin Laemmert
120bb0a66c
plugin/discovery: use new addrs.ProviderType in place of a provider typeName string (#22724)
This is a relatively small change meant to lay the foundation for
future enhancements to providers' address.
2019-09-09 16:59:50 -04:00