From 16c96cce92784cfb0f627ec8eadb97b58cfc26c7 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Thu, 24 Oct 2024 21:52:32 +0200 Subject: [PATCH] fix: Common Types - Added missing `export()` annotation (#3627) ## Description - Added missing `export()` annotation ## Pipeline Reference | Pipeline | | -------- | | [![avm.utl.types.avm-common-types](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.utl.types.avm-common-types.yml/badge.svg?branch=users%2Falsehr%2FsecretExportFix&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.utl.types.avm-common-types.yml) | ## Type of Change - [ ] Update to CI Environment or utilities (Non-module affecting changes) - [ ] Azure Verified Module updates: - [x] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation --- avm/utl/types/avm-common-types/README.md | 6 +-- avm/utl/types/avm-common-types/main.bicep | 25 +++++----- avm/utl/types/avm-common-types/main.json | 48 ++++++++++--------- .../tests/e2e/import/main.test.bicep | 6 +-- avm/utl/types/avm-common-types/version.json | 2 +- 5 files changed, 46 insertions(+), 41 deletions(-) diff --git a/avm/utl/types/avm-common-types/README.md b/avm/utl/types/avm-common-types/README.md index 97107533ab..26bc5bfc2b 100644 --- a/avm/utl/types/avm-common-types/README.md +++ b/avm/utl/types/avm-common-types/README.md @@ -65,7 +65,7 @@ import { privateEndpointMultiServiceType privateEndpointSingleServiceType secretToSetType - secretSetType + secretSetOutputType } from '../../../main.bicep' // Would be: br/public:avm/utl/types/avm-common-types: // ====================== // @@ -309,14 +309,14 @@ param secretToSet secretToSetType[] = [ #disable-next-line outputs-should-not-contain-secrets // Does not contain a secret output secretToSetOutput secretToSetType[] = secretToSet -param secretSet secretSetType[] = [ +param secretSet secretSetOutputType[] = [ { secretResourceId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.KeyVault/vaults/myVault/secrets/mySecret' secretUri: 'https://myVault.${az.environment().suffixes.keyvaultDns}/secrets/mySecret' secretUriWithVersion: 'https://myVault.${az.environment().suffixes.keyvaultDns}/secrets/mySecret/2f4783701d724537a4e0c2d473c31846' } ] -output secretSetOutput secretSetType[] = secretSet +output secretSetOutput secretSetOutputType[] = secretSet ``` diff --git a/avm/utl/types/avm-common-types/main.bicep b/avm/utl/types/avm-common-types/main.bicep index 03d63d0611..01f8e79c97 100644 --- a/avm/utl/types/avm-common-types/main.bicep +++ b/avm/utl/types/avm-common-types/main.bicep @@ -380,10 +380,20 @@ type customerManagedKeyType = { // ================== // // Secrets Export // // ================== // +@export() +@description('An AVM-aligned type for the secret to set via the secrets export feature.') +type secretToSetType = { + @description('Required. The name of the secret to set.') + name: string + + @description('Required. The value of the secret to set.') + @secure() + value: string +} @export() @description('An AVM-aligned type for the output of the secret set via the secrets export feature.') -type secretSetType = { +type secretSetOutputType = { @description('The resourceId of the exported secret.') secretResourceId: string @@ -395,17 +405,8 @@ type secretSetType = { } @export() -@description('An AVM-aligned type for the secret to set via the secrets export feature.') -type secretToSetType = { - @description('Required. The name of the secret to set.') - name: string - - @description('Required. The value of the secret to set.') - @secure() - value: string -} - +@description('A map of the exported secrets') type secretsOutputType = { @description('An exported secret\'s references.') - *: secretSetType + *: secretSetOutputType } diff --git a/avm/utl/types/avm-common-types/main.json b/avm/utl/types/avm-common-types/main.json index d941a20021..34218bb4a6 100644 --- a/avm/utl/types/avm-common-types/main.json +++ b/avm/utl/types/avm-common-types/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.30.23.60470", - "templateHash": "3702359687684026662" + "templateHash": "16862752319174543465" }, "name": "Default interface types for AVM modules", "description": "This module provides you with all common variants for AVM interfaces to be used in AVM modules.\n\nDetails for how to implement these interfaces can be found in the AVM documentation [here](https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces).\n", @@ -885,62 +885,66 @@ "description": "An AVM-aligned type for a customer-managed key." } }, - "secretSetType": { + "secretToSetType": { "type": "object", "properties": { - "secretResourceId": { - "type": "string", - "metadata": { - "description": "The resourceId of the exported secret." - } - }, - "secretUri": { + "name": { "type": "string", "metadata": { - "description": "The secret URI of the exported secret." + "description": "Required. The name of the secret to set." } }, - "secretUriWithVersion": { - "type": "string", + "value": { + "type": "securestring", "metadata": { - "description": "The secret URI with version of the exported secret." + "description": "Required. The value of the secret to set." } } }, "metadata": { "__bicep_export!": true, - "description": "An AVM-aligned type for the output of the secret set via the secrets export feature." + "description": "An AVM-aligned type for the secret to set via the secrets export feature." } }, - "secretToSetType": { + "secretSetOutputType": { "type": "object", "properties": { - "name": { + "secretResourceId": { "type": "string", "metadata": { - "description": "Required. The name of the secret to set." + "description": "The resourceId of the exported secret." } }, - "value": { - "type": "securestring", + "secretUri": { + "type": "string", "metadata": { - "description": "Required. The value of the secret to set." + "description": "The secret URI of the exported secret." + } + }, + "secretUriWithVersion": { + "type": "string", + "metadata": { + "description": "The secret URI with version of the exported secret." } } }, "metadata": { "__bicep_export!": true, - "description": "An AVM-aligned type for the secret to set via the secrets export feature." + "description": "An AVM-aligned type for the output of the secret set via the secrets export feature." } }, "secretsOutputType": { "type": "object", "properties": {}, "additionalProperties": { - "$ref": "#/definitions/secretSetType", + "$ref": "#/definitions/secretSetOutputType", "metadata": { "description": "An exported secret's references." } + }, + "metadata": { + "__bicep_export!": true, + "description": "A map of the exported secrets" } } }, diff --git a/avm/utl/types/avm-common-types/tests/e2e/import/main.test.bicep b/avm/utl/types/avm-common-types/tests/e2e/import/main.test.bicep index 1a087297a0..dd580dec93 100644 --- a/avm/utl/types/avm-common-types/tests/e2e/import/main.test.bicep +++ b/avm/utl/types/avm-common-types/tests/e2e/import/main.test.bicep @@ -24,7 +24,7 @@ import { privateEndpointMultiServiceType privateEndpointSingleServiceType secretToSetType - secretSetType + secretSetOutputType } from '../../../main.bicep' // Would be: br/public:avm/utl/types/avm-common-types: // ====================== // @@ -268,11 +268,11 @@ param secretToSet secretToSetType[] = [ #disable-next-line outputs-should-not-contain-secrets // Does not contain a secret output secretToSetOutput secretToSetType[] = secretToSet -param secretSet secretSetType[] = [ +param secretSet secretSetOutputType[] = [ { secretResourceId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.KeyVault/vaults/myVault/secrets/mySecret' secretUri: 'https://myVault.${az.environment().suffixes.keyvaultDns}/secrets/mySecret' secretUriWithVersion: 'https://myVault.${az.environment().suffixes.keyvaultDns}/secrets/mySecret/2f4783701d724537a4e0c2d473c31846' } ] -output secretSetOutput secretSetType[] = secretSet +output secretSetOutput secretSetOutputType[] = secretSet diff --git a/avm/utl/types/avm-common-types/version.json b/avm/utl/types/avm-common-types/version.json index 83083db694..1c035df49f 100644 --- a/avm/utl/types/avm-common-types/version.json +++ b/avm/utl/types/avm-common-types/version.json @@ -1,6 +1,6 @@ { "$schema": "https://aka.ms/bicep-registry-module-version-file-schema#", - "version": "0.1", + "version": "0.2", "pathFilters": [ "./main.json" ]