Skip to content

Commit 98f012f

Browse files
Backport tools.go change to v1 (#1265)
* Use `go install` instead of tools.go Previously, we were using tools.go to keep go.mod from changing during package installations. That is no longer needed. This will help to clean up incompatible licenses. #1238 * Docs: fix broken links (#1041) Update links to Kubernetes docs and examples. * Enable links check and fix 2 links (#1259) Co-authored-by: Neha Viswanathan <[email protected]>
1 parent e12a870 commit 98f012f

File tree

1,545 files changed

+183
-279614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,545 files changed

+183
-279614
lines changed

.go-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.5
1+
1.16.0

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
- docker
55
language: go
66
go:
7-
- 1.14.x
7+
- 1.16.x
88

99
env:
1010
- GO111MODULE=on
@@ -27,7 +27,7 @@ script:
2727

2828
branches:
2929
only:
30-
- master
30+
- main
3131
matrix:
3232
fast_finish: true
3333
allow_failures:

GNUmakefile

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ TEST := "$(PROVIDER_DIR)/kubernetes"
55
GOFMT_FILES := $$(find $(PROVIDER_DIR) -name '*.go' |grep -v vendor)
66
WEBSITE_REPO := github.com/hashicorp/terraform-website
77
PKG_NAME := kubernetes
8+
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
9+
TF_PROV_DOCS := $(PWD)/kubernetes/test-infra/tfproviderdocs
10+
EXT_PROV_DIR := $(PWD)/kubernetes/test-infra/external-providers
11+
EXT_PROV_BIN := /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH)/terraform-provider-kubernetes_9.9.9_$(OS_ARCH)
812

913
ifneq ($(PWD),$(PROVIDER_DIR))
1014
$(error "Makefile must be run from the provider directory")
1115
endif
1216

1317
default: build
1418

15-
all: build depscheck fmtcheck test testacc test-compile tests-lint tests-lint-fix tools vet website-lint website-lint-fix
19+
all: build depscheck fmtcheck test test-update testacc test-compile tests-lint tests-lint-fix tools vet website-lint website-lint-fix
1620

1721
build: fmtcheck
1822
go install
@@ -29,6 +33,18 @@ depscheck:
2933
@git diff --exit-code -- vendor || \
3034
(echo; echo "Unexpected difference in vendor/ directory. Run 'go mod vendor' command or revert any go.mod/go.sum/vendor changes and commit."; exit 1)
3135

36+
examples-lint: tools
37+
@echo "==> Checking _examples dir formatting..."
38+
@./scripts/fmt-examples.sh || (echo; \
39+
echo "Terraform formatting errors found in _examples dir."; \
40+
echo "To see the full differences, run: ./scripts/fmt-examples.sh diff"; \
41+
echo "To automatically fix the formatting, run 'make examples-lint-fix' and commit the changes."; \
42+
exit 1)
43+
44+
examples-lint-fix: tools
45+
@echo "==> Fixing terraform formatting of _examples dir..."
46+
@./scripts/fmt-examples.sh fix
47+
3248
fmt:
3349
gofmt -w $(GOFMT_FILES)
3450

@@ -40,8 +56,13 @@ test: fmtcheck
4056
echo $(TEST) | \
4157
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
4258

43-
testacc: fmtcheck
44-
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
59+
testacc: fmtcheck vet
60+
rm -rf $(EXT_PROV_DIR)/.terraform $(EXT_PROV_DIR)/.terraform.lock.hcl || true
61+
mkdir $(EXT_PROV_DIR)/.terraform
62+
mkdir -p /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH) || true
63+
ls $(EXT_PROV_BIN) || go build -o $(EXT_PROV_BIN)
64+
cd $(EXT_PROV_DIR) && TF_CLI_CONFIG_FILE=$(EXT_PROV_DIR)/.terraformrc TF_PLUGIN_CACHE_DIR=$(EXT_PROV_DIR)/.terraform terraform init -upgrade
65+
TF_CLI_CONFIG_FILE=$(EXT_PROV_DIR)/.terraformrc TF_PLUGIN_CACHE_DIR=$(EXT_PROV_DIR)/.terraform TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
4566

4667
test-compile:
4768
@if [ "$(TEST)" = "./..." ]; then \
@@ -64,15 +85,21 @@ tests-lint-fix: tools
6485
@find ./kubernetes -name "*_test.go" -exec sed -i ':a;N;$$!ba;s/fmt.Sprintf(`\n/fmt.Sprintf(`/g' '{}' \; # remove newlines for terrafmt
6586
@terrafmt fmt -f ./kubernetes --pattern '*_test.go'
6687

88+
test-update: fmtcheck vet
89+
rm -rf $(EXT_PROV_DIR)/.terraform $(EXT_PROV_DIR)/.terraform.lock.hcl || true
90+
mkdir $(EXT_PROV_DIR)/.terraform
91+
mkdir -p /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH) || true
92+
go clean -cache
93+
go build -o /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/$(OS_ARCH)/terraform-provider-kubernetes_9.9.9_$(OS_ARCH)
94+
cd $(EXT_PROV_DIR) && TF_CLI_CONFIG_FILE=$(EXT_PROV_DIR)/.terraformrc TF_PLUGIN_CACHE_DIR=$(EXT_PROV_DIR)/.terraform terraform init -upgrade
95+
TF_CLI_CONFIG_FILE=$(EXT_PROV_DIR)/.terraformrc TF_PLUGIN_CACHE_DIR=$(EXT_PROV_DIR)/.terraform TF_ACC=1 go test $(TEST) -v -run 'regression' $(TESTARGS)
96+
6797
tools:
68-
go install github.com/bflad/tfproviderdocs
69-
go install github.com/client9/misspell/cmd/misspell
70-
go install github.com/katbyte/terrafmt
71-
go mod tidy
72-
go mod vendor
73-
# TODO:
74-
# go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
75-
# go install github.com/golangci/golangci-lint/cmd/golangci-lint
98+
go install github.com/client9/misspell/cmd/[email protected]
99+
go install github.com/bflad/tfproviderlint/cmd/[email protected]
100+
go install github.com/bflad/[email protected]
101+
go install github.com/katbyte/[email protected]
102+
go install github.com/golangci/golangci-lint/cmd/[email protected]
76103

77104
vet:
78105
@echo "go vet ."
@@ -118,17 +145,15 @@ website-lint: tools
118145
echo "To automatically fix the formatting, run 'make website-lint-fix' and commit the changes."; \
119146
exit 1)
120147
@echo "==> Statically compiling provider for tfproviderdocs..."
121-
@env CGO_ENABLED=0 GOOS=$$(go env GOOS) GOARCH=$$(go env GOARCH) go build -a -o terraform-providers-schema/terraform-provider-kubernetes
148+
@env CGO_ENABLED=0 GOOS=$$(go env GOOS) GOARCH=$$(go env GOARCH) go build -a -o $(TF_PROV_DOCS)/terraform-provider-kubernetes
122149
@echo "==> Getting provider schema for tfproviderdocs..."
123-
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(PROVIDER_DIR)/terraform-providers-schema:/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 init
124-
@$(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
150+
@$(DOCKER) run $(DOCKER_RUN_OPTS) -v $(TF_PROV_DOCS):/workspace:$(DOCKER_VOLUME_OPTS) -w /workspace hashicorp/terraform:0.12.29 init
151+
@$(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
125152
@echo "==> Running tfproviderdocs..."
126-
@tfproviderdocs check -providers-schema-json terraform-providers-schema/schema.json -provider-name kubernetes
127-
@rm -f terraform-providers-schema/schema.json terraform-providers-schema/terraform-provider-kubernetes
128-
# @echo "==> Checking for broken links..."
129-
#@scripts/markdown-link-check.sh "$(DOCKER)" "$(DOCKER_RUN_OPTS)" "$(DOCKER_VOLUME_OPTS)" "$(PROVIDER_DIR)"
130-
# TODO: enable this check when links have been fixed.
131-
# https://github.com/hashicorp/terraform-provider-kubernetes/issues/990
153+
@tfproviderdocs check -providers-schema-json $(TF_PROV_DOCS)/schema.json -provider-name kubernetes
154+
@rm -f $(TF_PROV_DOCS)/schema.json $(TF_PROV_DOCS)/terraform-provider-kubernetes
155+
@echo "==> Checking for broken links..."
156+
@scripts/markdown-link-check.sh "$(DOCKER)" "$(DOCKER_RUN_OPTS)" "$(DOCKER_VOLUME_OPTS)" "$(PROVIDER_DIR)"
132157

133158
website-lint-fix: tools
134159
@echo "==> Applying automatic website linter fixes..."
@@ -139,4 +164,3 @@ website-lint-fix: tools
139164
@terrafmt fmt ./website --pattern '*.markdown'
140165

141166
.PHONY: build test testacc tools vet fmt fmtcheck terrafmt test-compile depscheck tests-lint tests-lint-fix website-lint website-lint-fix
142-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Please note: We take Terraform's security and our users' trust very seriously. I
2222

2323
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
2424
- Note that version 0.11.x currently works, but is [deprecated](https://www.hashicorp.com/blog/deprecating-terraform-0-11-support-in-terraform-providers/)
25-
- [Go](https://golang.org/doc/install) 1.14.x (to build the provider plugin)
25+
- [Go](https://golang.org/doc/install) 1.16.x (to build the provider plugin)
2626

2727

2828
## Kubernetes Alpha Provider

go.mod

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,20 @@ require (
55
github.com/Azure/go-autorest/autorest v0.11.6 // indirect
66
github.com/Azure/go-autorest/autorest/azure/cli v0.4.1 // indirect
77
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
8-
github.com/Djarvur/go-err113 v0.1.0 // indirect
98
github.com/MakeNowJust/heredoc v1.0.0 // indirect
109
github.com/agext/levenshtein v1.2.3 // indirect
1110
github.com/apparentlymart/go-cidr v1.1.0 // indirect
1211
github.com/aws/aws-sdk-go v1.34.21 // indirect
13-
github.com/bflad/tfproviderdocs v0.7.0
14-
github.com/bflad/tfproviderlint v0.18.0
15-
github.com/bmatcuk/doublestar v1.3.2 // indirect
16-
github.com/client9/misspell v0.3.4
1712
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
1813
github.com/emicklei/go-restful v2.14.2+incompatible // indirect
1914
github.com/go-logr/logr v0.2.1 // indirect
2015
github.com/go-openapi/jsonreference v0.19.4 // indirect
2116
github.com/go-openapi/spec v0.19.9 // indirect
2217
github.com/go-openapi/swag v0.19.9 // indirect
23-
github.com/golangci/golangci-lint v1.31.0
24-
github.com/golangci/misspell v0.3.5 // indirect
25-
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
2618
github.com/google/go-cmp v0.5.2
2719
github.com/google/gofuzz v1.2.0 // indirect
2820
github.com/google/uuid v1.1.2 // indirect
2921
github.com/googleapis/gnostic v0.5.1 // indirect
30-
github.com/gookit/color v1.2.9 // indirect
31-
github.com/gostaticanalysis/analysisutil v0.2.1 // indirect
3222
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
3323
github.com/hashicorp/go-hclog v0.14.1 // indirect
3424
github.com/hashicorp/go-uuid v1.0.2 // indirect
@@ -43,32 +33,22 @@ require (
4333
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
4434
github.com/imdario/mergo v0.3.11 // indirect
4535
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
46-
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
47-
github.com/katbyte/terrafmt v0.2.1-0.20200303174203-e6a3e82cb21b
4836
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 // indirect
4937
github.com/kr/pretty v0.2.1 // indirect
50-
github.com/magiconair/properties v1.8.2 // indirect
5138
github.com/mailru/easyjson v0.7.6 // indirect
52-
github.com/matoous/godox v0.0.0-20200801072554-4fb83dc2941e // indirect
5339
github.com/mitchellh/cli v1.1.1 // indirect
5440
github.com/mitchellh/go-homedir v1.1.0
5541
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
5642
github.com/mitchellh/mapstructure v1.3.3 // indirect
5743
github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2 // indirect
5844
github.com/oklog/run v1.1.0 // indirect
59-
github.com/pelletier/go-toml v1.8.0 // indirect
45+
github.com/onsi/ginkgo v1.13.0 // indirect
6046
github.com/posener/complete v1.2.3 // indirect
61-
github.com/quasilyte/regex/syntax v0.0.0-20200805063351-8f842688393c // indirect
6247
github.com/robfig/cron v1.2.0
6348
github.com/spf13/afero v1.3.5 // indirect
64-
github.com/spf13/cast v1.3.1 // indirect
65-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
66-
github.com/stretchr/objx v0.3.0 // indirect
67-
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b // indirect
6849
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20200807230610-d5346d47e3af
6950
github.com/terraform-providers/terraform-provider-azurerm v1.44.1-0.20200911233120-57b2bfc9d42c
7051
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f // indirect
71-
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 // indirect
7252
github.com/ulikunitz/xz v0.5.8 // indirect
7353
github.com/zclconf/go-cty v1.6.1 // indirect
7454
github.com/zclconf/go-cty-yaml v1.0.2 // indirect
@@ -81,7 +61,6 @@ require (
8161
google.golang.org/api v0.31.0 // indirect
8262
google.golang.org/genproto v0.0.0-20200911024640-645f7a48b24f // indirect
8363
google.golang.org/grpc v1.32.0 // indirect
84-
gopkg.in/ini.v1 v1.61.0 // indirect
8564
k8s.io/api v0.19.1
8665
k8s.io/apimachinery v0.19.1
8766
k8s.io/client-go v11.0.0+incompatible
@@ -90,8 +69,6 @@ require (
9069
k8s.io/kube-openapi v0.0.0-20200831175022-64514a1d5d59 // indirect
9170
k8s.io/kubectl v0.19.1
9271
k8s.io/utils v0.0.0-20200821003339-5e75c0163111 // indirect
93-
mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d // indirect
94-
mvdan.cc/unparam v0.0.0-20200501210554-b37ab49443f7 // indirect
9572
)
9673

9774
// kustomize needs to be kept in sync with the cli-runtime.

0 commit comments

Comments
 (0)