Add port, remote backup & CIDRs support (#371) #1079
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform Provider Checks | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
- develop | |
paths-ignore: | |
- '**.md' | |
env: | |
GO_VERSION: "1.18" | |
TERRAFORM_VERSION: "1.2.6" | |
jobs: | |
go_mod_download: | |
name: go mod download | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
id: cache-go-pkg-mod | |
timeout-minutes: 2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- if: steps.cache-go-pkg-mod.outputs.cache-hit != 'true' || steps.cache-go-pkg-mod.outcome == 'failure' | |
run: go mod download | |
go_build: | |
name: go build | |
needs: [go_mod_download] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
id: cache-terraform-plugin-dir | |
timeout-minutes: 2 | |
with: | |
path: terraform-plugin-dir | |
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# See also: https://github.com/actions/setup-go/issues/54 | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
name: go env | |
run: | | |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/cache@v3.0.5 | |
with: | |
path: ${{ env.GOCACHE }} | |
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
uses: actions/cache@v3.0.5 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' | |
name: go build | |
run: go build -o terraform-plugin-dir/registry.terraform.io/RedisLabs/rediscloud/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-rediscloud . | |
terraform_providers_schema: | |
name: terraform providers schema | |
needs: [go_build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
id: cache-terraform-providers-schema | |
timeout-minutes: 2 | |
with: | |
path: terraform-providers-schema | |
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
uses: actions/cache@v3.0.5 | |
timeout-minutes: 2 | |
with: | |
path: terraform-plugin-dir | |
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
uses: hashicorp/setup-terraform@v2.0.0 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
terraform_wrapper: false | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
name: terraform init | |
run: | | |
# We need a file to initialize the provider | |
cat <<EOT >> providers.tf | |
terraform { | |
required_providers { | |
rediscloud = { | |
source = "RedisLabs/rediscloud" | |
version = "99.99.99" | |
} | |
} | |
} | |
EOT | |
echo 'resource "rediscloud_subscription" "example" {}' > example.tf | |
terraform init -plugin-dir terraform-plugin-dir | |
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' | |
name: terraform providers schema | |
run: | | |
mkdir terraform-providers-schema | |
terraform providers schema -json > terraform-providers-schema/schema.json | |
go_test: | |
name: go test | |
needs: [go_build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# See also: https://github.com/actions/setup-go/issues/54 | |
- name: go env | |
run: | | |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
timeout-minutes: 2 | |
with: | |
path: ${{ env.GOCACHE }} | |
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
timeout-minutes: 2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- uses: dorny/paths-filter@v2.10.2 | |
id: filter | |
with: | |
filters: | | |
code-changes: | |
- 'go.mod' | |
- 'go.sum' | |
- 'provider/**' | |
- '*.go' | |
- '.github/workflows/**' | |
- run: make testacc | |
if: steps.filter.outputs.code-changes == 'true' | |
env: | |
REDISCLOUD_ACCESS_KEY: ${{ secrets.REDISCLOUD_ACCESS_KEY_QA }} | |
REDISCLOUD_SECRET_KEY: ${{ secrets.REDISCLOUD_SECRET_KEY_QA }} | |
REDISCLOUD_URL: https://api-cloudapi.qa.redislabs.com/v1 | |
AWS_TEST_CLOUD_ACCOUNT_NAME: "${{ secrets.AWS_TEST_CLOUD_ACCOUNT_NAME }}" | |
# REDISCLOUD_ACCESS_KEY: ${{ secrets.REDISCLOUD_ACCESS_KEY_PROD }} | |
# REDISCLOUD_SECRET_KEY: ${{ secrets.REDISCLOUD_SECRET_KEY_PROD }} | |
# REDISCLOUD_URL: https://api.redislabs.com/v1/ | |
# AWS_TEST_CLOUD_ACCOUNT_NAME: PM | |
AWS_PEERING_REGION: ${{ secrets.AWS_PEERING_REGION }} | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
AWS_VPC_CIDR: ${{ secrets.AWS_VPC_CIDR }} | |
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }} | |
TF_ACC: true | |
TF_LOG: debug | |
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUD_ACCOUNT_KEY }} | |
AWS_ACCESS_SECRET_KEY: ${{ secrets.CLOUD_ACCOUNT_SECRET }} | |
AWS_CONSOLE_USERNAME: ${{ secrets.CLOUD_ACCOUNT_USERNAME }} | |
AWS_CONSOLE_PASSWORD: ${{ secrets.CLOUD_ACCOUNT_PASS }} | |
AWS_SIGNIN_URL: ${{ secrets.CLOUD_ACCOUNT_URL }} | |
tfproviderlint: | |
name: tfproviderlint | |
needs: [go_build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# See also: https://github.com/actions/setup-go/issues/54 | |
- name: go env | |
run: | | |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
timeout-minutes: 2 | |
with: | |
path: ${{ env.GOCACHE }} | |
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }} | |
- uses: actions/cache@v3.0.5 | |
continue-on-error: true | |
timeout-minutes: 2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
- run: make tfproviderlint |