Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Terraform SDK to v2 #1027

Merged
merged 15 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 10 additions & 0 deletions .terraformrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider_installation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this configuration is specific to our testing workflow, would it make sense to place in a subfolder that highlights its purpose as a test asset? Like somewhere in a testdata folder or similar?

I'm trying to avoid it being misinterpreted by users as an example of how to deploy the provider (far fetched, but I'd rather be safe).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I do have a directory we can use for this: kubernetes/test-infra/external-providers. I'll use that.

filesystem_mirror {
path = "/tmp/.terraform.d"
include = ["localhost/test/kubernetes"]
}
direct {
include = ["registry.terraform.io/*/*"]
}
}
disable_checkpoint = true
20 changes: 14 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ TEST := "$(PROVIDER_DIR)/kubernetes"
GOFMT_FILES := $$(find $(PROVIDER_DIR) -name '*.go' |grep -v vendor)
WEBSITE_REPO := github.com/hashicorp/terraform-website
PKG_NAME := kubernetes
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
TF_PROV_DOCS := $(PWD)/kubernetes/test-infra/tfproviderdocs

ifneq ($(PWD),$(PROVIDER_DIR))
$(error "Makefile must be run from the provider directory")
Expand Down Expand Up @@ -41,7 +43,13 @@ test: fmtcheck
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4

testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
rm -rf $(PWD)/.terraform || true
mkdir $(PWD)/.terraform
mkdir -p /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH) || true
dak1n1 marked this conversation as resolved.
Show resolved Hide resolved
dak1n1 marked this conversation as resolved.
Show resolved Hide resolved
go clean -cache
go build -o /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH)/terraform-provider-kubernetes_9.9.9_$(OS_ARCH)
cd $(PWD)/kubernetes/test-infra/external-providers && TF_CLI_CONFIG_FILE=$(PWD)/.terraformrc TF_PLUGIN_CACHE_DIR=$(PWD)/.terraform terraform init
TF_CLI_CONFIG_FILE=$(PWD)/.terraformrc TF_PLUGIN_CACHE_DIR=$(PWD)/.terraform TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m

test-compile:
@if [ "$(TEST)" = "./..." ]; then \
Expand Down Expand Up @@ -118,13 +126,13 @@ website-lint: tools
echo "To automatically fix the formatting, run 'make website-lint-fix' and commit the changes."; \
exit 1)
@echo "==> Statically compiling provider for tfproviderdocs..."
@env CGO_ENABLED=0 GOOS=$$(go env GOOS) GOARCH=$$(go env GOARCH) go build -a -o terraform-providers-schema/terraform-provider-kubernetes
@env CGO_ENABLED=0 GOOS=$$(go env GOOS) GOARCH=$$(go env GOARCH) go build -a -o $(TF_PROV_DOCS)/terraform-provider-kubernetes
@echo "==> Getting provider schema for tfproviderdocs..."
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(PROVIDER_DIR)/terraform-providers-schema:/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 init
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(PROVIDER_DIR)/terraform-providers-schema:/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 providers schema -json > ./terraform-providers-schema/schema.json
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(TF_PROV_DOCS):/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 init
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(TF_PROV_DOCS):/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 providers schema -json > $(TF_PROV_DOCS)/schema.json
@echo "==> Running tfproviderdocs..."
@tfproviderdocs check -providers-schema-json terraform-providers-schema/schema.json -provider-name kubernetes
@rm -f terraform-providers-schema/schema.json terraform-providers-schema/terraform-provider-kubernetes
@tfproviderdocs check -providers-schema-json $(TF_PROV_DOCS)/schema.json -provider-name kubernetes
@rm -f $(TF_PROV_DOCS)/schema.json $(TF_PROV_DOCS)/terraform-provider-kubernetes
# @echo "==> Checking for broken links..."
#@scripts/markdown-link-check.sh "$(DOCKER)" "$(DOCKER_RUN_OPTS)" "$(DOCKER_VOLUME_OPTS)" "$(PROVIDER_DIR)"
# TODO: enable this check when links have been fixed.
Expand Down
22 changes: 3 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ module github.com/hashicorp/terraform-provider-kubernetes

require (
cloud.google.com/go/storage v1.11.0 // indirect
github.com/Azure/go-autorest/autorest v0.11.6 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.1 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
github.com/Djarvur/go-err113 v0.1.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
Expand All @@ -31,26 +28,22 @@ require (
github.com/gostaticanalysis/analysisutil v0.2.1 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.2.1
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl/v2 v2.6.0 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20200806211835-c481b8bfa41e // indirect
github.com/hashicorp/terraform-json v0.6.0 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.15.0
github.com/hashicorp/terraform-provider-google v1.20.1-0.20200824213103-e32ba28ec398
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.4-0.20200930154456-951f045a9f14
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/katbyte/terrafmt v0.2.1-0.20200303174203-e6a3e82cb21b
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/magiconair/properties v1.8.2 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/matoous/godox v0.0.0-20200801072554-4fb83dc2941e // indirect
github.com/mitchellh/cli v1.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect
Expand All @@ -65,13 +58,8 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b // indirect
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20200807230610-d5346d47e3af
github.com/terraform-providers/terraform-provider-azurerm v1.44.1-0.20200911233120-57b2bfc9d42c
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f // indirect
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/zclconf/go-cty v1.6.1 // indirect
github.com/zclconf/go-cty-yaml v1.0.2 // indirect
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
Expand Down Expand Up @@ -104,13 +92,9 @@ replace (
sigs.k8s.io/kustomize/pkg/transformers/config => ./vendor/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/config
)

// pin version until https://github.com/moby/term/pull/14 is merged - newer commits break the windows/386 builds
replace (
// for azurerm provider
github.com/Azure/go-autorest/autorest => github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a

// pin version until https://github.com/moby/term/pull/14 is merged - newer commits break the windows/386 builds
github.com/moby/term => github.com/moby/term v0.0.0-20200507123241-dbdd9cc6608d

golang.org/x/sys => golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6
)

Expand Down
Loading