Skip to content

Commit

Permalink
Merge branch 'main' into PORT-6792-disable-automations-revert
Browse files Browse the repository at this point in the history
  • Loading branch information
pazhersh committed Jun 9, 2024
2 parents 8d3816e + 58f8e1b commit 3650362
Show file tree
Hide file tree
Showing 133 changed files with 5,742 additions and 565 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@talsabagport @danielsinai @dvirsegev @matarpeles @pazhersh @MPTG94
@talsabagport @danielsinai @dvirsegev @matarpeles @pazhersh @MPTG94 @erikzaadi
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
passphrase: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
uses: goreleaser/goreleaser-action@v6.0.0
with:
version: latest
args: release --rm-dist
version: '~> v2'
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Run dialect tests
run: make acctest PORT_CLIENT_ID=${{ secrets.PORT_CLIENT_ID }} PORT_CLIENT_SECRET=${{ secrets.PORT_CLIENT_SECRET }}
run: make acctest PORT_CLIENT_ID=${{ secrets.PORT_CLIENT_ID }} PORT_CLIENT_SECRET=${{ secrets.PORT_CLIENT_SECRET }} PORT_BASE_URL=${{ secrets.PORT_BASE_URL }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ local/
__debug_bin*
terraform-provider-port-labs
.idea
**/terraform.tfstat*
**/.terraform
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
version: 2
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down Expand Up @@ -57,4 +58,4 @@ release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
disable: true
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing to the Port Terraform Provider

## Setting up your developer workspace:

* Have [golang](https://go.dev/doc/install) installed
* Run `make dev-setup`

## Verifying your contribution:

Be sure to run:

```sh
make lint
```

**NOTE**: Should be installed with `make dev-setup`, if you prefer manually, have a look at the [installation guide](https://golangci-lint.run/welcome/install/#local-installation).


In addition, when changing documentation, run `make gen-docs`.

You can preview how the documentation will look in the Terraform registry with [this tool](https://registry.terraform.io/tools/doc-preview).

## Running your tests

Expose the following environment variables:

`PORT_CLIENT_ID`

`PORT_CLIENT_SECRET`

`PORT_BASE_URL` - Optional

Then run:

```sh
make acctest

# or filtered for your specific test:

TEST_FILTER=.*MyCustomResource.* make acctest
```
## Running your code as the actual terraform provider

```sh
make dev-run-integration
```

Then export the printed `TF_REATTACH_PROVIDERS` environment variable, then your `terraform` will use your running code.

## Debugging your code with `dlv`

Install [Delve](https://github.com/go-delve/delve)

```sh
make dev-debug
```
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ VERSION=0.9.6
OS=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)
OS_ARCH=${OS}_${ARCH}
TEST_FILTER?=.*

default: install

Expand All @@ -29,9 +30,6 @@ release:
clean:
rm -rf examples/.terraform examples/.terraform.lock.hcl examples/terraform*

run-example:
cd examples && terraform init && terraform apply

install: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
Expand All @@ -40,7 +38,23 @@ setup:
cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

acctest:
TF_ACC=1 PORT_CLIENT_ID=$(PORT_CLIENT_ID) PORT_CLIENT_SECRET=$(PORT_CLIENT_SECRET) go test -p 1 ./...
# TEST_FILTER can be any regex, E.g: .*PageResource.*
# TEST_FILTER='TestAccPortPageResource*' make acctest
TF_ACC=1 PORT_CLIENT_ID=$(PORT_CLIENT_ID) PORT_CLIENT_SECRET=$(PORT_CLIENT_SECRET) PORT_BASE_URL=$(PORT_BASE_URL) go test -p 1 ./... -run "$(TEST_FILTER)"

gen-docs:
tfplugindocs

lint: build
# https://golangci-lint.run/welcome/install/#local-installation
golangci-lint run

dev-run-integration: build
PORT_BETA_FEATURES_ENABLED=true go run . --debug

dev-setup: setup
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.59.0

dev-debug: build
PORT_BETA_FEATURES_ENABLED=true dlv exec --accept-multiclient --continue --headless ./terraform-provider-port-labs -- --debug

10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Port is the Developer Platform meant to supercharge your DevOps and Developers,

## Documentation

- [Terraform registry docs](https://registry.terraform.io/providers/port-labs/port/latest/docs)
- [Terraform registry docs](https://registry.terraform.io/providers/port-labs/port-labs/latest/docs)
- [Port docs](https://docs.getport.io/build-your-software-catalog/sync-data-to-catalog/iac/terraform)

## Requirements
Expand All @@ -30,7 +30,7 @@ terraform {
required_providers {
port = {
source = "port-labs/port-labs"
version = "~> 1.0.0"
version = "~> 2.0.0"
}
}
}
Expand All @@ -49,4 +49,8 @@ terraform init

## Examples

please refer to the [examples](./examples) directory
Please refer to the [examples](./examples) directory

## Contributing

Please refer to [contributing.md](./CONTRIBUTING.md)
Loading

0 comments on commit 3650362

Please sign in to comment.