Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from iwarapter/feature/tf-sdk-2
Browse files Browse the repository at this point in the history
Feature/tf sdk 2
  • Loading branch information
iwarapter authored Jul 7, 2020
2 parents 27a9a8d + 45c34df commit f3d5918
Show file tree
Hide file tree
Showing 1,739 changed files with 60,970 additions and 175,037 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on: [push, pull_request]
name: ci
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

- name: Install tools
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u honnef.co/go/tools/cmd/staticcheck
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Staticcheck
run: |
export PATH=$PATH:$(go env GOPATH)/bin
staticcheck ./...
- name: Check dependencies
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)
echo "==> Checking source code with go mod vendor..."
go mod vendor
git diff --compact-summary --exit-code -- vendor || \
(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)
- name: Test
env:
PING_IDENTITY_DEVOPS_USER: ${{ secrets.PING_IDENTITY_DEVOPS_USER }}
PING_IDENTITY_DEVOPS_KEY: ${{ secrets.PING_IDENTITY_DEVOPS_KEY }}
run: |
TF_ACC=1 go test -mod=vendor ./... -v -trimpath -coverprofile=coverage.out
go tool cover -func=coverage.out
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
72 changes: 72 additions & 0 deletions .github/workflows/functional.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on: [push]
name: e2e
jobs:
e2e:
name: e2e
strategy:
matrix:
pingaccess-version: [5.2.3, 5.3.2, 6.0.2, 6.1.0]
services:
pingaccess:
image: pingidentity/pingaccess:${{ matrix.pingaccess-version }}-edge
env:
PING_IDENTITY_ACCEPT_EULA: YES
PING_IDENTITY_DEVOPS_USER: ${{ secrets.PING_IDENTITY_DEVOPS_USER }}
PING_IDENTITY_DEVOPS_KEY: ${{ secrets.PING_IDENTITY_DEVOPS_KEY }}
ports:
- 9000:9000
pingfederate:
image: pingidentity/pingfederate:10.0.2-edge
env:
PING_IDENTITY_ACCEPT_EULA: YES
PING_IDENTITY_DEVOPS_USER: ${{ secrets.PING_IDENTITY_DEVOPS_USER }}
PING_IDENTITY_DEVOPS_KEY: ${{ secrets.PING_IDENTITY_DEVOPS_KEY }}
SERVER_PROFILE_URL: https://github.com/pingidentity/pingidentity-server-profiles.git
SERVER_PROFILE_PATH: getting-started/pingfederate
ports:
- 9999:9999
- 9031:9031

runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Setup Test Environment
run: |
curl -k -i -H "Content-Type: application/json" -H "X-Xsrf-Header: PingFederate" --user Administrator:2FederateM0re -d "@func-tests/pf-settings.json" -X PUT https://localhost:9999/pf-admin-api/v1/serverSettings
curl -k https://localhost:9031/.well-known/openid-configuration
- name: Change default PA password for 5.2
if: ${{ startsWith( matrix.pingaccess-version , '5.2') }}
run: sed -i 's/2FederateM0re/2Access/g' func-tests/main.tf

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1

- name: Install Build and Deploy
run: make build deploy-local

- name: Terraform Init
run: make func-init

- name: Terraform Plan
run: make func-plan
env:
TF_VAR_pa6: ${{ startsWith( matrix.pingaccess-version , '6') }}

- name: Terraform Apply
run: make func-apply
env:
TF_VAR_pa6: ${{ startsWith( matrix.pingaccess-version , '6') }}

- name: Terraform Plan
run: make func-plan
env:
TF_VAR_pa6: ${{ startsWith( matrix.pingaccess-version , '6') }}
14 changes: 14 additions & 0 deletions .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: gosec
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v2
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- openbsd
- solaris
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
- goos: openbsd
goarch: arm
- goos: openbsd
goarch: arm64
binary: '{{ .ProjectName }}_v{{ .Version }}'
flags: |
-gcflags="-trimpath=$GOPATH" -asmflags="-trimpath=$GOPATH"
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--local-user"
- "BE9710A9C84DA5AA" # Replace this with your GPG signing key ID
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
draft: true
changelog:
skip: true
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

31 changes: 7 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,24 @@
# Makefile
VERSION ?= 0.0.0
NAME=terraform-provider-pingaccess_v${VERSION}
BASE_DOCKER_TAG=terraform-provider-pingaccess-test
PINGACCESS_VERSION=6.1.0-edge
BASE_DOCKER_TAG=pingidentity/pingaccess:${PINGACCESS_VERSION}

pa-init:
@docker build -t ${BASE_DOCKER_TAG} .
@docker run --rm -d --hostname pingaccess --name pingaccess -e PING_IDENTITY_DEVOPS_KEY=$(PING_IDENTITY_DEVOPS_KEY) -e PING_IDENTITY_DEVOPS_USER=$(PING_IDENTITY_DEVOPS_USER) -e PING_IDENTITY_ACCEPT_EULA=YES --publish 9000:9000 ${BASE_DOCKER_TAG}

test:
@rm -f pingaccess/terraform.log
@TF_LOG=TRACE TF_LOG_PATH=./terraform.log TF_ACC=1 go test -mod=vendor ./... -v
@TF_LOG=TRACE TF_LOG_PATH=./terraform.log TF_ACC=1 go test -mod=vendor ./... -v -trimpath -coverprofile=coverage.out && go tool cover -func=coverage.out

unit-test:
@go test -mod=vendor ./... -v

@go test -mod=vendor ./... -v -trimpath

test-and-report:
@rm -f pingaccess/terraform.log coverage.out report.json
@TF_LOG=TRACE TF_LOG_PATH=./terraform.log TF_ACC=1 go test -mod=vendor ./... -v -coverprofile=coverage.out -json > report.json && go tool cover -func=coverage.out
TF_LOG=TRACE TF_LOG_PATH=./terraform.log TF_ACC=1 go test -mod=vendor ./... -v -trimpath -coverprofile=coverage.out -json | tee report.json

build:
@go build -mod=vendor -o ${NAME} -gcflags "all=-trimpath=$GOPATH" .

release:
@rm -rf build/*
GOOS=darwin GOARCH=amd64 go build -mod=vendor -o build/darwin_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/darwin_amd64.zip build/darwin_amd64/${NAME}
GOOS=freebsd GOARCH=386 go build -mod=vendor -o build/freebsd_386/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/freebsd_386.zip build/freebsd_386/${NAME}
GOOS=freebsd GOARCH=amd64 go build -mod=vendor -o build/freebsd_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/freebsd_amd64.zip build/freebsd_amd64/${NAME}
GOOS=freebsd GOARCH=arm go build -mod=vendor -o build/freebsd_arm/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/freebsd_arm.zip build/freebsd_arm/${NAME}
GOOS=linux GOARCH=386 go build -mod=vendor -o build/linux_386/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/linux_386.zip build/linux_386/${NAME}
GOOS=linux GOARCH=amd64 go build -mod=vendor -o build/linux_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/linux_amd64.zip build/linux_amd64/${NAME}
GOOS=linux GOARCH=arm go build -mod=vendor -o build/linux_arm/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/linux_arm.zip build/linux_arm/${NAME}
GOOS=openbsd GOARCH=386 go build -mod=vendor -o build/openbsd_386/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/openbsd_386.zip build/openbsd_386/${NAME}
GOOS=openbsd GOARCH=amd64 go build -mod=vendor -o build/openbsd_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/openbsd_amd64.zip build/openbsd_amd64/${NAME}
GOOS=solaris GOARCH=amd64 go build -mod=vendor -o build/solaris_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/solaris_amd64.zip build/solaris_amd64/${NAME}
GOOS=windows GOARCH=386 go build -mod=vendor -o build/windows_386/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/windows_386.zip build/windows_386/${NAME}
GOOS=windows GOARCH=amd64 go build -mod=vendor -o build/windows_amd64/${NAME} -gcflags "all=-trimpath=$$GOPATH" . && zip -j build/windows_amd64.zip build/windows_amd64/${NAME}
@go build -mod=vendor -o ${NAME} -trimpath .

deploy-local:
@mkdir -p ~/.terraform.d/plugins
Expand All @@ -48,7 +31,7 @@ func-init:
@cd func-tests && terraform init

func-plan:
@cd func-tests && terraform plan
@cd func-tests && TF_LOG=TRACE TF_LOG_PATH=./terraform.log terraform plan

func-apply:
@cd func-tests && TF_LOG=TRACE TF_LOG_PATH=./terraform.log terraform apply -auto-approve
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ PingAccess Terraform Provider
- [![Gitter](https://badges.gitter.im/iwarapter/terraform-provider-pingaccess.svg)](https://gitter.im/iwarapter/terraform-provider-pingaccess?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=github.conef.uk.iwarapter.terraform-provider-pingaccess&metric=coverage)](https://sonarcloud.io/dashboard?id=github.conef.uk.iwarapter.terraform-provider-pingaccess)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=github.conef.uk.iwarapter.terraform-provider-pingaccess&metric=alert_status)](https://sonarcloud.io/dashboard?id=github.conef.uk.iwarapter.terraform-provider-pingaccess)
[![Build Status](https://travis-ci.org/iwarapter/terraform-provider-pingaccess.svg?branch=master)](https://travis-ci.org/iwarapter/terraform-provider-pingaccess)
![ci](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/ci/badge.svg)
![e2e](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/e2e/badge.svg)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/iwarapter/terraform-provider-pingaccess)

<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">
Expand Down Expand Up @@ -45,6 +46,15 @@ Using the Provider

To use a released provider in your Terraform environment, download the latest version from https://github.com/iwarapter/terraform-provider-pingaccess/releases and follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin) After placing it into your plugins directory, run `terraform init` to initialize it.

The provider is current tested against the following versions of PingAccess

| PingAccess | Status |
|------------|--------|
| 5.2.3 | ![e2e](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/e2e/badge.svg)|
| 5.3.2 | ![e2e](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/e2e/badge.svg)|
| 6.0.2 | ![e2e](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/e2e/badge.svg)|
| 6.1.0 | ![e2e](https://github.com/iwarapter/terraform-provider-pingaccess/workflows/e2e/badge.svg)|

Testing the Provider
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_access_token_validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Provides a access token validator.

## Example Usage
```terraform
{!../pingaccess/test_cases/access_token_validator.tf!}
{!../func-tests//access_token_validator.tf!}
```

## Argument Attributes
Expand Down
5 changes: 4 additions & 1 deletion docs/resources/pingaccess_acme_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Provides a acme server.

## Example Usage
```terraform
{!../pingaccess/test_cases/acme_server.tf!}
resource "pingaccess_acme_server" "test" {
name = "example"
url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
```

## Argument Attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_application.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a application.

## Example Usage
```terraform
{!../pingaccess/test_cases/application.tf!}
{!../func-tests//application.tf!}
```

## Argument Attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_application_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a application resource.

## Example Usage
```terraform
{!../pingaccess/test_cases/application_resource.tf!}
{!../func-tests//application_resource.tf!}
```

## Argument Attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_auth_token_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Provides a auth token management.

## Example Usage
```terraform
{!../pingaccess/test_cases/auth_token_management.tf!}
{!../func-tests//auth_token_management.tf!}
```

## Argument Attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_authn_req_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a AuthN Req List.

## Example Usage
```terraform
{!../pingaccess/test_cases/authn_req_list.tf!}
{!../func-tests//authn_req_list.tf!}
```

## Argument Attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pingaccess_certificate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a ceritficate.

### Example Usage
```terraform
{!../pingaccess/test_cases/certificate.tf!}
{!../func-tests//certificate.tf!}
```
### Argument Attributes
The following arguments are supported:
Expand Down
Loading

0 comments on commit f3d5918

Please sign in to comment.