Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into gh-559-xml-connection-options-computed
  • Loading branch information
willvedd committed Apr 28, 2023
2 parents f6dfc44 + a7e809f commit 275062c
Show file tree
Hide file tree
Showing 215 changed files with 26,899 additions and 9,876 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🚀 Feature Request
description: Suggest an idea or a feature for this project
labels: [ "feature" ]
labels: [ ":seedling: feature" ]

body:
- type: markdown
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/report_a_bug.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🐛 Report a bug
description: Have you found a bug or issue? Create a bug report for this provider
labels: [ "bug" ]
labels: [ ":beetle: bug" ]

body:
- type: markdown
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out the code
uses: actions/checkout@v3
go-version-file: go.mod
check-latest: true

- name: Run tests
run: make test-acc-e2e
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
name: Checks
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out the code
uses: actions/checkout@v3
go-version-file: go.mod
check-latest: true

- name: Check that docs were generated
run: make check-docs
Expand All @@ -35,16 +36,17 @@ jobs:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out the code
uses: actions/checkout@v3
go-version-file: go.mod
check-latest: true

- name: Run tests
run: make test
run: make test-acc

- name: Update codecov report
uses: codecov/codecov-action@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version-file: go.mod
check-latest: true

- name: Import GPG key
id: import_gpg
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/sweep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ jobs:
name: Sweep
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out source
uses: actions/checkout@v3
go-version-file: go.mod
check-latest: true

- name: Sweep
run: make test-sweep
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
run:
go: 1.19
timeout: 2m
allow-parallel-runners: true

Expand Down
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
## 0.45.0

BUG FIXES:

- `resource/auth0_branding_theme`: Fixed typo in `fonts.links_style` validation ([#523](https://github.com/auth0/terraform-provider-auth0/pull/523))
- `data-source/auth0_resource_server`: Fixed data source to always return the id instead of the identifier ([#532](https://github.com/auth0/terraform-provider-auth0/pull/532))

FEATURES:

- `data-source/auth0_custom_domain`: Added data source to fetch custom domain ([#526](https://github.com/auth0/terraform-provider-auth0/pull/526))
- `resource/auth0_connection`: Added support for ping federate connections ([#527](https://github.com/auth0/terraform-provider-auth0/pull/527))

ENHANCEMENTS:

- `resource/auth0_client_grant`: Check if client grant already exists before creating ([#529](https://github.com/auth0/terraform-provider-auth0/pull/529))
- `resource/auth0_connection`: Added `disable_self_service_change_password` flag to database connection ([#525](https://github.com/auth0/terraform-provider-auth0/pull/525))

NOTES:

- Updated docs for `auth0_role` resource ([#524](https://github.com/auth0/terraform-provider-auth0/pull/524))


## 0.44.1

BUG FIXES:

- `resource/auth0_prompt_custom_text`: Added missing status prompt type ([#513](https://github.com/auth0/terraform-provider-auth0/pull/513))
- `data-source/auth0_connection`: Moved check for config secrets from the read to the update func ([#517](https://github.com/auth0/terraform-provider-auth0/pull/517))

ENHANCEMENTS:

- `resource/auth0_branding_theme`: Made fields optional ([#499](https://github.com/auth0/terraform-provider-auth0/pull/499))

NOTES:

- Added docs on available log stream types ([#462](https://github.com/auth0/terraform-provider-auth0/pull/462))
- Added docs on how to obtain the custom domain id for importing `auth0_custom_domain` resources ([#463](https://github.com/auth0/terraform-provider-auth0/pull/463))


## 0.44.0

BUG FIXES:

- `resource/auth0_prompt_custom_text`: Added missing prompt types ([#506](https://github.com/auth0/terraform-provider-auth0/pull/506))
- `resource/auth0_branding`: Fixed resource to allow managing only the universal login ([#506](https://github.com/auth0/terraform-provider-auth0/pull/506))

FEATURES:

- `data-source/auth0_connection`: Added data source to fetch connection information ([#470](https://github.com/auth0/terraform-provider-auth0/pull/470))
- `data-source/auth0_resource_server`: Added data source to fetch resource server information ([#477](https://github.com/auth0/terraform-provider-auth0/pull/477))
- `data-source/auth0_organization`: Added data source to fetch organization information ([#475](https://github.com/auth0/terraform-provider-auth0/pull/475))
- `data-source/auth0_tenant`: Expanded data source to fetch all the tenant information ([#479](https://github.com/auth0/terraform-provider-auth0/pull/479))
- `data-source/auth0_user`: Added data source to fetch user information ([#481](https://github.com/auth0/terraform-provider-auth0/pull/481))
- `data-source/auth0_role`: Added data source to fetch role information ([#483](https://github.com/auth0/terraform-provider-auth0/pull/483))
- `data-source/auth0_attack_protection`: Added data source to fetch attack protection information ([#485](https://github.com/auth0/terraform-provider-auth0/pull/485))
- `data-source/auth0_branding`: Added data source to fetch branding information ([#500](https://github.com/auth0/terraform-provider-auth0/pull/500))
- `data-source/auth0_branding_theme`: Added data source to fetch branding theme information ([#500](https://github.com/auth0/terraform-provider-auth0/pull/500))
- `resource/auth0_branding_theme`: Simplified management of this resource to no longer force a user to import the resource if already existing ([#504](https://github.com/auth0/terraform-provider-auth0/pull/504))

NOTES:

- `resource/auth0_connection`: Updated connection docs ([#471](https://github.com/auth0/terraform-provider-auth0/pull/471))
- `resource/auth0_tenant`: Added deprecation notice to `flags.universal_login` ([#503](https://github.com/auth0/terraform-provider-auth0/pull/503))


## 0.43.0

BUG FIXES:
Expand Down
95 changes: 60 additions & 35 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
# Contributing

Before you begin, read through the Terraform documentation on
[Extending Terraform](https://www.terraform.io/docs/extend/index.html) and
[Writing Custom Providers](https://learn.hashicorp.com/collections/terraform/providers).

Finally,
the [HashiCorp Provider Design Principles](https://www.terraform.io/docs/extend/hashicorp-provider-design-principles.html)
explore the underlying principles for the design choices of this provider.
We appreciate feedback and contribution to this provider.
Before you submit a pull request, there are a couple requirements to satisfy.

## Prerequisites

- [Go 1.18+](https://go.dev/)
- [Terraform](https://developer.hashicorp.com/terraform/downloads)

## Reading Material

- [Extending Terraform](https://www.terraform.io/docs/extend/index.html) - design, develop, and test plugins that connect Terraform to external services.
- [Writing Custom Providers](https://learn.hashicorp.com/collections/terraform/providers) - tutorials on interacting with APIs using Terraform providers.
- [HashiCorp Provider Design Principles](https://www.terraform.io/docs/extend/hashicorp-provider-design-principles.html) - explore the underlying principles for the design choices of this provider.

## Getting started
## Getting Started

To work on the provider, you'll need [Go](http://www.golang.org) installed on your machine(version 1.18+ is *required*).
You'll also need to correctly set up a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin`
to your `$PATH`.
To work on the provider, you'll need [Go](https://go.dev/) installed on your machine (version 1.18+ is *required*).
You'll also need to set up a [`$GOPATH`](https://go.dev/doc/code.html#GOPATH), and add `$GOPATH/bin` to your `$PATH`.

To compile the provider, run `make install VERSION=X.X.X`. This will build the provider and install the provider binary
in the `${HOME}/.terraform.d/plugins` directory, so it can be used directly in terraform `required_providers` block.

```sh
```shell
make install VERSION=0.2.0
...
~/.terraform.d/plugins/registry.terraform.io/auth0/auth0/0.2.0/darwin_amd64/terraform-provider-auth0_v0.2.0
# On macOS, this will install the provider in a location like the following:
# ~/.terraform.d/plugins/registry.terraform.io/auth0/auth0/0.2.0/darwin_amd64/terraform-provider-auth0_v0.2.0
...
```

Expand All @@ -39,39 +41,62 @@ terraform {
}
```

## Running tests
## Documentation

The documentation found in the [docs](./docs) folder is generated using
[terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs).
Do not edit files within this folder manually.

Run `make docs` to regenerate documentation for newly added resources and schema attributes or if changes are needed to existing schemas.

```shell
make docs
```

## Running the Tests

The tests can be run using the following make commands:

- `make test-unit` - runs all the unit tests.
- `make test-acc` - runs the tests with http recordings. To run a specific test pass the `FILTER` var. Usage `make test-acc FILTER="TestAccResourceServer"`.
- `make test-acc-e2e` - runs the tests against a real Auth0 tenant. To run a specific test pass the `FILTER` var. Usage `make test-acc-e2e FILTER="TestAccResourceServer"`.

To run the tests use the `make test` command. This will make use of the pre-recorded http interactions found in the
[recordings](./test/data/recordings) folder. To add new recordings run the tests against an Auth0 tenant
individually using the following env vars `AUTH0_HTTP_RECORDINGS=on TF_ACC=true`.
> **Note**
> The http test recordings can be found in the [recordings](./test/data/recordings) folder.
To run the tests against an Auth0 tenant, use the `make test-acc-e2e` command. Start by creating an
To run the tests against an Auth0 tenant start by creating an
[M2M app](https://auth0.com/docs/applications/set-up-an-application/register-machine-to-machine-applications) in the
tenant, that has been authorized to call the Management API and has all the required permissions.
tenant, that has been authorized to request access tokens for the Management API and has all the required permissions.

Then set the following environment variables:
Then set the following environment variables on your machine:

* `AUTH0_DOMAIN`: The **Domain** of the M2M app
* `AUTH0_CLIENT_ID`: The **Client ID** of the M2M app
* `AUTH0_CLIENT_SECRET`: The **Client Secret** of the M2M app
* `AUTH0_DEBUG`: Set to `true` to call the Management API in debug mode, which dumps the HTTP requests and responses to
the output
* `AUTH0_DEBUG`: Set to `true` to call the Management API in debug mode, which dumps the HTTP requests and responses to the output

**Note:** The e2e acceptance tests make calls to a real Auth0 tenant, and create real resources. Certain tests also
require a paid Auth0 subscription to be able to run successfully, e.g. `TestAccCustomDomain` and the ones starting with
`TestAccLogStream*`.
> **Warning**
> The e2e acceptance tests make calls to a real Auth0 tenant, and create real resources.
> Certain tests also require a paid Auth0 subscription to be able to run successfully,
> e.g. `TestAccCustomDomain` and the ones starting with `TestAccLogStream*`.
**Note:** At the time of writing, the following configuration steps are also required for the test tenant:
> **Note**
> At the time of writing, the following configuration steps are also required for the test tenant:
> - The `Username-Password-Authentication` connection must have _Requires Username_ option enabled for the user tests to successfully run.
* The `Username-Password-Authentication` connection must have _Requires Username_ option enabled for the user tests to
successfully run.
## Adding New HTTP Test Recordings

## Documentation
When creating a new Terraform resource or adding a new resource property, the http recordings will need to be re-recorded.
To add new http test recordings or to regenerate old ones, use the `make test-acc-record` command.

The documentation found in the [docs](./docs) folder is generated using
[terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs). Please run `make docs` to regenerate
documentation for newly added resources or schema attributes.
> **Warning**
> If you need to regenerate an old recording, make sure to delete the corresponding recording file first.
```sh
make docs
```
To add only one specific http test recording pass the `FILTER` var, for example `make test-acc-record FILTER="TestAccResourceServer"`.

> **Warning**
> Recording a new http test interaction will make use of a real Auth0 test tenant.
## Resetting the Test Tenant

All resources created through running the tests against an Auth0 tenant can be removed by running `make test-sweep`.
63 changes: 46 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ BUILD_DIR ?= $(CURDIR)/out

GO_OS ?= $(shell go env GOOS)
GO_ARCH ?= $(shell go env GOARCH)
GO_PACKAGES := $(shell go list ./... | grep -v vendor)
GO_FILES := $(shell find . -name '*.go' | grep -v vendor)
GO_PACKAGES := $(shell go list ./... | grep -vE "vendor|tools|sweep|acctest")
GO_LINT_SCRIPT ?= $(CURDIR)/scripts/golangci-lint.sh
GO_TEST_COVERAGE_FILE ?= "coverage.out"

Expand Down Expand Up @@ -114,25 +113,55 @@ check-vuln: ## Check go vulnerabilities
#-----------------------------------------------------------------------------------------------------------------------
.PHONY: test test-unit test-acc test-sweep

test: test-unit test-acc ## Run all tests

test-unit: ## Run unit tests
test-unit: ## Run unit tests. To run a specific test, pass the FILTER var. Usage `make test-unit FILTER="TestAccResourceServer`
${call print, "Running unit tests"}
@go test ${GO_PACKAGES} || exit 1
@echo ${GO_PACKAGES} | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4

test-acc: ## Run acceptance tests with http recordings
${call print, "Running acceptance tests"}
@AUTH0_HTTP_RECORDINGS=on AUTH0_DOMAIN=terraform-provider-auth0-dev.eu.auth0.com TF_ACC=1 \
go test ${GO_PACKAGES} -v $(TESTARGS) -timeout 120m -coverprofile="${GO_TEST_COVERAGE_FILE}"

test-acc-e2e: ## Run acceptance tests end to end
${call print, "Running acceptance tests E2E"}
@TF_ACC=1 go test ${GO_PACKAGES} -v $(TESTARGS) -timeout 120m -coverprofile="${GO_TEST_COVERAGE_FILE}"
@TF_ACC= \
go test \
-v \
-run "$(FILTER)" \
-timeout 30s \
-coverprofile="${GO_TEST_COVERAGE_FILE}" \
${GO_PACKAGES}

test-acc: ## Run acceptance tests with http recordings. To run a specific test, pass the FILTER var. Usage `make test-acc FILTER="TestAccResourceServer`
${call print, "Running acceptance tests with http recordings"}
@AUTH0_HTTP_RECORDINGS=on \
AUTH0_DOMAIN=terraform-provider-auth0-dev.eu.auth0.com \
TF_ACC=1 \
go test \
-v \
-run "$(FILTER)" \
-timeout 120m \
-coverprofile="${GO_TEST_COVERAGE_FILE}" \
${GO_PACKAGES}

test-acc-record: ## Run acceptance tests and record http interactions. To run a specific test, pass the FILTER var. Usage `make test-acc-record FILTER="TestAccResourceServer`
${call print, "Running acceptance tests and recording http interactions"}
@AUTH0_HTTP_RECORDINGS=on \
TF_ACC=1 \
go test \
-v \
-run "$(FILTER)" \
-timeout 120m \
${GO_PACKAGES}

test-acc-e2e: ## Run acceptance tests without http recordings. To run a specific test, pass the FILTER var. Usage `make test-acc-e2e FILTER="TestAccResourceServer`
${call print, "Running acceptance tests against a real Auth0 tenant"}
@TF_ACC=1 \
go test \
-v \
-run "$(FILTER)" \
-timeout 120m \
-parallel 1 \
-coverprofile="${GO_TEST_COVERAGE_FILE}" \
${GO_PACKAGES}

test-sweep: ## Clean up test tenant
${call print_warning, "WARNING: This will destroy infrastructure. Use only in development accounts."}
@go test ./internal/provider -v -sweep="phony" $(SWEEPARGS)
@read -p "Continue? [y/N] " ans && ans=$${ans:-N} ; \
if [ $${ans} = y ] || [ $${ans} = Y ]; then \
go test ./internal/acctest/sweep -v -sweep="phony" $(SWEEPARGS) ; \
fi

#-----------------------------------------------------------------------------------------------------------------------
# Helpers
Expand Down
Loading

0 comments on commit 275062c

Please sign in to comment.