From cc7ad721eb3a8049b224309177f1f73c58328ec0 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 17 Aug 2023 17:06:04 +0200 Subject: [PATCH] chore: fix passing additional providers --- .../workflows/cdktf-provider-docs-rollout.yml | 16 +++++---------- .github/workflows/registry-docs-pr-based.yml | 20 +++++++++++++++++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cdktf-provider-docs-rollout.yml b/.github/workflows/cdktf-provider-docs-rollout.yml index 8ab6b25c15..3615e3ae09 100644 --- a/.github/workflows/cdktf-provider-docs-rollout.yml +++ b/.github/workflows/cdktf-provider-docs-rollout.yml @@ -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. diff --git a/.github/workflows/registry-docs-pr-based.yml b/.github/workflows/registry-docs-pr-based.yml index 63d49feab2..1ac640ed0a 100644 --- a/.github/workflows/registry-docs-pr-based.yml +++ b/.github/workflows/registry-docs-pr-based.yml @@ -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 @@ -154,9 +155,23 @@ 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 }}' \ @@ -164,7 +179,8 @@ jobs: --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