Skip to content

Commit

Permalink
fix: Common Types - Added missing export() annotation (#3627)
Browse files Browse the repository at this point in the history
## Description

- Added missing `export()` annotation

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| 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

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] 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
  • Loading branch information
AlexanderSehr authored Oct 24, 2024
1 parent a0c516b commit 16c96cc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 41 deletions.
6 changes: 3 additions & 3 deletions avm/utl/types/avm-common-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
privateEndpointMultiServiceType
privateEndpointSingleServiceType
secretToSetType
secretSetType
secretSetOutputType
} from '../../../main.bicep' // Would be: br/public:avm/utl/types/avm-common-types:<version>
// ====================== //
Expand Down Expand Up @@ -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
```

</details>
Expand Down
25 changes: 13 additions & 12 deletions avm/utl/types/avm-common-types/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
}
48 changes: 26 additions & 22 deletions avm/utl/types/avm-common-types/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
privateEndpointMultiServiceType
privateEndpointSingleServiceType
secretToSetType
secretSetType
secretSetOutputType
} from '../../../main.bicep' // Would be: br/public:avm/utl/types/avm-common-types:<version>

// ====================== //
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion avm/utl/types/avm-common-types/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.1",
"version": "0.2",
"pathFilters": [
"./main.json"
]
Expand Down

0 comments on commit 16c96cc

Please sign in to comment.