Skip to content

Commit

Permalink
update to TF 1.8.0 and renaming -tf to -jet
Browse files Browse the repository at this point in the history
sync with provider-jet-template@d938ff2
updated golangci-lint to 1.48.0 for compat with newer go

Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Aug 26, 2022
1 parent 09aa5c1 commit 0062e68
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 39 deletions.
65 changes: 49 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# ====================================================================================
# Setup Project

PROJECT_NAME := provider-tf-equinix
PROJECT_NAME := provider-jet-equinix
PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME)
GOLANGCILINT_VERSION ?= 1.48.0

export TERRAFORM_VERSION := 1.1.6

export TERRAFORM_VERSION := 1.0.11
export TERRAFORM_PROVIDER_SOURCE := equinix/equinix
export TERRAFORM_PROVIDER_VERSION := 1.3.0
export TERRAFORM_PROVIDER_VERSION := 1.8.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME := terraform-provider-equinix
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX := https://releases.hashicorp.com/terraform-provider-equinix/1.3.0
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX := https://releases.hashicorp.com/terraform-provider-equinix/1.8.0
#export TERRAFORM_NATIVE_PROVIDER_BINARY := terraform-provider-null_v3.1.0_x5

PLATFORMS ?= linux_amd64 linux_arm64

Expand All @@ -35,7 +38,7 @@ NPROCS ?= 1
# to half the number of CPU cores.
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))

GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
GO_SUBDIRS += cmd internal apis
GO111MODULE = on
Expand All @@ -49,12 +52,12 @@ GO111MODULE = on
# ====================================================================================
# Setup Images

DOCKER_REGISTRY := crossplane
IMAGES = provider-tf-equinix provider-tf-equinix-controller
DOCKER_REGISTRY ?= crossplane
IMAGES = provider-jet-equinix provider-jet-equinix-controller
-include build/makelib/image.mk

# ====================================================================================
# Targets
# Fallthrough

# run `make help` to see the targets and options

Expand All @@ -67,21 +70,51 @@ fallthrough: submodules
@echo Initial setup complete. Running make again . . .
@make

# ====================================================================================
# Setup Terraform for fetching provider schema
TERRAFORM := $(TOOLS_HOST_DIR)/terraform-$(TERRAFORM_VERSION)
TERRAFORM_WORKDIR := $(WORK_DIR)/terraform
TERRAFORM_PROVIDER_SCHEMA := config/schema.json

$(TERRAFORM):
@$(INFO) installing terraform $(HOSTOS)-$(HOSTARCH)
@mkdir -p $(TOOLS_HOST_DIR)/tmp-terraform
@curl -fsSL https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_$(SAFEHOST_PLATFORM).zip -o $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip
@unzip $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip -d $(TOOLS_HOST_DIR)/tmp-terraform
@mv $(TOOLS_HOST_DIR)/tmp-terraform/terraform $(TERRAFORM)
@rm -fr $(TOOLS_HOST_DIR)/tmp-terraform
@$(OK) installing terraform $(HOSTOS)-$(HOSTARCH)

$(TERRAFORM_PROVIDER_SCHEMA): $(TERRAFORM)
@$(INFO) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)
@mkdir -p $(TERRAFORM_WORKDIR)
@echo '{"terraform":[{"required_providers":[{"provider":{"source":"'"$(TERRAFORM_PROVIDER_SOURCE)"'","version":"'"$(TERRAFORM_PROVIDER_VERSION)"'"}}],"required_version":"'"$(TERRAFORM_VERSION)"'"}]}' > $(TERRAFORM_WORKDIR)/main.tf.json
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) init > $(TERRAFORM_WORKDIR)/terraform-logs.txt 2>&1
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) providers schema -json=true > $(TERRAFORM_PROVIDER_SCHEMA) 2>> $(TERRAFORM_WORKDIR)/terraform-logs.txt
@$(OK) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)

generate.init: $(TERRAFORM_PROVIDER_SCHEMA)

.PHONY: $(TERRAFORM_PROVIDER_SCHEMA)
# ====================================================================================
# Targets

# NOTE: the build submodule currently overrides XDG_CACHE_HOME in order to
# force the Helm 3 to use the .work/helm directory. This causes Go on Linux
# machines to use that directory as the build cache as well. We should adjust
# this behavior in the build submodule because it is also causing Linux users
# to duplicate their build cache, but for now we just make it easier to identify
# its location in CI so that we cache between builds.
go.cachedir:
@go env GOCACHE

# Generate a coverage report for cobertura applying exclusions on
# - generated file
cobertura:
@cat $(GO_TEST_OUTPUT)/coverage.txt | \
grep -v zz_ | \
$(GOCOVER_COBERTURA) > $(GO_TEST_OUTPUT)/cobertura-coverage.xml

crds.clean:
@$(INFO) cleaning generated CRDs
@find package/crds -name '*.yaml' -exec sed -i.sed -e '1,2d' {} \; || $(FAIL)
@find package/crds -name '*.yaml.sed' -delete || $(FAIL)
@$(OK) cleaned generated CRDs

generate.done: crds.clean

# Update the submodules, such as the common build scripts.
submodules:
@git submodule sync
Expand Down
41 changes: 18 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
# Terrajet Equinix Provider

`provider-tf-equinix` is a [Crossplane](https://crossplane.io/) provider that
is built using [Terrajet](https://github.com/crossplane-contrib/terrajet) code
generation tools and exposes XRM-conformant managed resources for the
`provider-jet-equinix` is a [Crossplane](https://crossplane.io/) provider that
is built using [Terrajet](https://github.com/crossplane/terrajet) code
generation tools and exposes XRM-conformant managed resources for the
Equinix API.

## Getting Started

Install the provider by using the following command after changing the image tag
to the [latest release](https://github.com/crossplane-contrib/provider-tf-equinix/releases):
to the [latest release](https://github.com/crossplane-contrib/provider-jet-equinix/releases):
```
kubectl crossplane install provider crossplane/provider-tf-equinix:v0.1.0
kubectl crossplane install provider crossplane/provider-jet-equinix:v0.1.0
```

You can see the API reference [here](https://doc.crds.dev/github.com/crossplane-contrib/provider-tf-equinix).
Alternatively, you can use declarative installation:
```
kubectl apply -f examples/install.yaml
```

Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.

You can see the API reference [here](https://doc.crds.dev/github.com/crossplane-contrib/provider-jet-equinix).

## Developing

Run code-generation pipeline:
```console
go run cmd/generator/main.go
go run cmd/generator/main.go "$PWD"
```

Run against a Kubernetes cluster:
Expand All @@ -34,18 +41,6 @@ Build, push, and install:
make all
```

Build image:

```console
make image
```

Push image:

```console
make push
```

Build binary:

```console
Expand All @@ -55,7 +50,7 @@ make build
## Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please
open an [issue](https://github.com/crossplane-contrib/provider-tf-equinix/issues).
open an [issue](https://github.com/crossplane-contrib/provider-jet-equinix/issues).

## Contact

Expand All @@ -69,17 +64,17 @@ Please use the following to reach members of the community:

## Governance and Owners

provider-tf-equinix is run according to the same
provider-jet-equinix is run according to the same
[Governance](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md)
and [Ownership](https://github.com/crossplane/crossplane/blob/master/OWNERS.md)
structure as the core Crossplane project.

## Code of Conduct

provider-tf-equinix adheres to the same [Code of
provider-jet-equinix adheres to the same [Code of
Conduct](https://github.com/crossplane/crossplane/blob/master/CODE_OF_CONDUCT.md)
as the core Crossplane project.

## Licensing

provider-tf-equinix is under the Apache 2.0 license.
provider-jet-equinix is under the Apache 2.0 license.

0 comments on commit 0062e68

Please sign in to comment.