hashicorp / terraform-provider-scaffolding Goto Github PK
View Code? Open in Web Editor NEWQuick start repository for creating a Terraform provider
License: Mozilla Public License 2.0
Quick start repository for creating a Terraform provider
License: Mozilla Public License 2.0
The page of “Writing Custom Providers” DOES NOT exist which is describe in “These files contain boilerplate code that you will need to edit to create your own Terraform provider. A full guide to creating Terraform providers can be found at Writing Custom Providers.”
Add a VS Code launch.json that shows how to do acceptance testing debugging and also external Terraform execution / debugging with *.tf files on disk.
We are trying to build and sign this 3rd party provider, but https://github.com/checkly/terraform-provider-checkly but I think we are missing one step in the setup docs as published here https://www.terraform.io/docs/registry/providers/publishing.html#github-actions-preferred-
Is the Env.GPG_FINGERPRINT
actually the same as the mentioned GPG_PRIVATE_KEY
?
https://github.com/checkly/terraform-provider-checkly/runs/1209221389?check_suite_focus=true
It should build and sign the provider
It errors out on not finding the variable GPG_FINGERPRINT - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
push a tagged release on the mentioned repo
Hey, I cannot find any information about actually using this provider in my configuration files.
For ex. after building the binary what should I do now to use that provider in my terraform config without actually publishing it into registry?
hashicorp/terraform#25906
hashicorp/terraform#26123
https://discuss.hashicorp.com/t/easiest-way-to-use-a-local-custom-provider-with-terraform-0-13/12691
Could current vendor/vendor.json
added to this repo?
I ended up copying from https://github.com/terraform-providers/terraform-provider-null/blob/master/vendor/vendor.json
Thanks
When running make testacc
on checked out code i'm getting Provider "scaffolding" not available for installation.
, i guess the scaffolding isn't up to date anymore. Is there some example of SDK v2 provider tests?
Once SDKv2 is released, this should be updated to use it and we should add some example tests.
It should probably also be updated to use the context.Context
version of the functions.
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform v0.13.5
try toiport Key in github action
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
-
name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Error: Could not find valid encryption key packet in key 62b905cxxxxxxx
import gpg private key
🔮 Checking GPG private key
Error: Could not find valid encryption key packet in key 62b905cxxxxxxx
Hi @paultyng,
Do you think you could fork the Github action paultyng/[email protected] to Hashicorp's Github org? Since this deals with private GPG keys, it feels like it would be better to trust hashicorp than single employees. What do you think?
Hi, many thanks for refactoring this repo for external audience. We have been using this as a template for a while. Both this repo and terraform-provider-template is mentioned in the docs and they are very similar, but this seemed to be most up to date.
We noticed the Travis CI configuration was removed in some previous pull request. This is feature request / suggestion to add GitHub Actions workflow to replace Travis CI.
Example GitHub Actions workflow (.github/workflows/test.yml
):
name: test
on:
pull_request:
push:
branches:
- master
jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2-beta
with:
go-version: '~1.13'
- run: go test -v ./...
golangci-lint:
runs-on: ubuntu-latest
container: golangci/golangci-lint:v1.24
steps:
- uses: actions/checkout@v2
- run: golangci-lint run ./...
tfproviderlint:
runs-on: ubuntu-latest
container: bflad/tfproviderlint:0.14
steps:
- uses: actions/checkout@v2
- run: tfproviderlint ./...
Many thanks for considering,
An example of
ValidateFunc
would be helpful.
Currently, I cannot get it running:
"host_path": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateDiagFunc: validateDockerContainerPath,
},
and the implementation:
func validateDockerContainerPath() schema.SchemaValidateDiagFunc {
return func(v interface{}, path cty.Path) diag.Diagnostics {
value := v.(string)
var diags diag.Diagnostics
if !regexp.MustCompile(`^[a-zA-Z]:\\|^/`).MatchString(value) {
diags = append(diags, diag.Errorf("%q must be an absolute path", value)...)
}
return diags
}
}
I get the error
cannot use validateDockerContainerPath (value of type func() schema.SchemaValidateDiagFunc) as schema.SchemaValidateDiagFunc value in struct literal
v0.14.3
v2.4.0
I filed this originally on the generated repo:
hashicorp/terraform-provider-hcp#450
basically the sso browser dance works one time from terraform if I provide no parameters to the hcp provider. once that expires and I try to apply terraform a second time, it just tells me i have no valid auth and does not retrigger the browser based login flow with HCP.
Sorry for opening this here, but it seems impossible to reach [email protected]
(we've emailed too).
We are not able to publish new versions to cloudamqp/cloudamqp. It started with a release that wasn't picked up by the registry, similar to hashicorp/terraform#27533.
In my efforts to try to solve that, I read the following and removed the webhook from our repo, hoping I would be able to re-add it.
If the webhook is missing or not functioning, you can use the Resync button on the provider settings page. First, remove any existing webhooks for registry.terraform.io. Then, click the Resync button on the Terraform Registry's provider settings page. A new webhook should be created.
Problem is, I can't see any Resync button anywhere. How can we get the webhook back? How can get publishing releases to Terraform Registry working again?
Thanks for your time.
cc @bflad @paddycarver sorry to mention you, but I saw you were active here yesterday and I'm a bit desperate to be honest
N/A (main branch development)
Following the Go support policy and given the ecosystem availability and stability of the latest Go minor version, it's time to upgrade. This will ensure that this project can use recent improvements to the Go runtime, standard library functionality, and continue to receive security updates
//+build
:go mod edit -go=1.17
go mod tidy
go fix
.github/workflows/*.yml
) use 1.18 in place of any 1.17 and 1.17 in place of any 1.16 or earlier.go-version
is at least 1.17 or latertenv
linter in .golangci.yml
and remediate any issues.As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with 👍 for support, or 👎 if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init
. Once merged, dependencies can be added or updated as follows:
$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor
GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:
$ GO111MODULE=on go mody tidy
$ GO111MODULE=on go mod vendor
Thank you sincerely for all your time, contributions, and cooperation!
Add explicit ignores to goreleaser config for the following flavours.
ignore:
- goos: darwin
goarch: '386'
- goos: darwin
goarch: 'arm'
- goos: freebsd
goarch: 'arm64'
- goos: windows
goarch: 'arm'
- goos: windows
goarch: 'arm64'
Currently, the suggested goreleaser configuration is as below, and go 1.17 builds almost the entire matrix. But the problem is that some of the flavours are not officially supported/endorsed by Terraform, and building them wastes resources and CI credits.
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
According to the provider docs that link to this project, only the following flavours need to be built:
goos\goarch | amd64 | 386 | arm | arm64 |
---|---|---|---|---|
darwin | x | x | ||
freebsd | x | x | ||
linux | x | x | x | x |
windows | x | x |
Looking at what various providers push to Terraform registry, it's the same matrix, but with one addition: freebsd_arm
.
For example, here and here. Hence the suggested list of explicit ignores to align with the current state.
Following the Go support policy and given the ecosystem availability of the latest Go minor version, it's time to upgrade. This will ensure that this project can use recent improvements to the Go runtime, standard library functionality, and continue to receive security updates
go mod edit -go=1.18
go mod tidy
go fix ./...
.github/workflows/*.yml
) use 1.19 in place of any 1.18 and 1.18 in place of any 1.17 or earlier.go-version
is at least 1.18 or laterHi there,
I’m creating a new Provider, but i have some doubts in provider Factories.
I’m following terraform-provider-scaffolding so in provider_test.go i have the following:
var providerFactories = map[string]func() (*schema.Provider, error){
"acdcn": func() (*schema.Provider, error) {
return New("dev")(), nil
},
}
Then in resource test file i would like access to Provider to be able to use my api client to delete the created resource. I’m trying the following:
provider, err := providerFactories["acdcn"]()
apiClient := provider.Meta().(*client.Client)
But the provider.Meta() is always nil. How i can access to my api client configured in provider?
The Test works well, the resource is created, but i’m unable to destroy the resource inside function configured in CheckDestroy.
Thanks
Documentation unclear on how best to impliment a resource schema beyond string values.
Current Example
resource "scaffolding_resource" "example" {
sample_attribute = "foo"
}
Desired Example
resource "scaffolding_resource" "example" {
sample_attribute = "foo"
sample_list_attribute = [ "foo", "bar" ]
sample_map_attribute = { foo = "bar" }
}
Terraform v1.1.7
on darwin_arm64
CreateContext
, etc. See https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/schema#Resource.
The need for this has been removed so the scaffolding documentation for new providers should reflect this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.