Skip to content

Commit

Permalink
chore: fix passing additional providers
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Aug 17, 2023
1 parent 69d9661 commit cc7ad72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/cdktf-provider-docs-rollout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,34 @@ jobs:
# To onboard new providers, add a new entry to this matrix and make sure the team-tf-cdk github user has write permissions to the repository.
- repo: hashicorp/terraform-provider-archive
fqn: "hashicorp/archive"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-aws
fqn: "hashicorp/aws"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-cloudinit
fqn: "hashicorp/cloudinit"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-dns
fqn: "hashicorp/dns"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-external
fqn: "hashicorp/external"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-http
fqn: "hashicorp/http"
additionalProviderFqns: ""
additionalProviderFqns: "hashicorp/random@~>3.5"
- repo: hashicorp/terraform-provider-local
fqn: "hashicorp/local"
additionalProviderFqns: ""
additionalProviderFqns: "hashicorp/aws@~>5.12"
- repo: hashicorp/terraform-provider-null
fqn: "hashicorp/null"
additionalProviderFqns: ""
additionalProviderFqns: "hashicorp/aws@~>5.12"
- repo: hashicorp/terraform-provider-random
fqn: "hashicorp/random"
additionalProviderFqns: "hashicorp/aws@~>5.12"
- repo: hashicorp/terraform-provider-tfe
fqn: "hashicorp/tfe"
additionalProviderFqns: ""
- repo: hashicorp/terraform-provider-time
fqn: "hashicorp/time"
additionalProviderFqns: ""
additionalProviderFqns: "hashicorp/aws@~>5.12"
- repo: hashicorp/terraform-provider-tls
fqn: "hashicorp/tls"
additionalProviderFqns: ""
additionalProviderFqns: "hashicorp/aws@~>5.12"
uses: ./.github/workflows/registry-docs-pr-based.yml
secrets:
# This token belongs to the team-tf-cdk github user. The user needs to have write permissions to the repository.
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/registry-docs-pr-based.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
description: "Additional provider FQNs that are required to convert because they are used in examples, e.g. 'hashicorp/azurerm,hashicorp/google'"
required: false
type: string
default: ""
maxRunners:
description: "Maximum number of parallel runners to use"
required: false
Expand Down Expand Up @@ -154,17 +155,32 @@ jobs:
- name: Install cdktf-registry-docs
run: npm install -g cdktf-registry-docs@${{ inputs.cdktfRegistryDocsVersion }}

- name: Run conversion
- name: Run conversion without additional providers
if: inputs.additionalProviderFqns == ''
run: |
cdktf-registry-docs convert \
--files='${{ matrix.files }}' \
--languages='${{inputs.languages}}' \
--parallel-file-conversions=${{ inputs.parallelFileConversions }} \
--parallel-conversions-per-document=${{ inputs.parallelConversionsPerDocument }}\
--provider-from-registry="${{ inputs.providerFqn }}" \
.
env:
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins

- name: Run conversion with additional providers
# It's a bit hacky with the additionalProviderFqns handling of optionally putting this flag in
# Maybe it's easier solved through duplication and an if statement
if: inputs.additionalProviderFqns != ''
run: |
cdktf-registry-docs convert \
--files='${{ matrix.files }}' \
--languages='${{inputs.languages}}' \
--parallel-file-conversions=${{ inputs.parallelFileConversions }} \
--parallel-conversions-per-document=${{ inputs.parallelConversionsPerDocument }}\
--provider-from-registry="${{ inputs.providerFqn }}" \
${{ inputs.additionalProviderFqns == '' && '.' || format('--additional-providers-from-registry={0} .',inputs.additionalProviderFqns) }}
--additional-providers-from-registry="${{ inputs.additionalProviderFqns }}" \
.
env:
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins

Expand Down

0 comments on commit cc7ad72

Please sign in to comment.