Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added UDT for Managed identity and Deployment Scripts #1224

Merged
merged 14 commits into from
Mar 11, 2024

Conversation

johnlokerse
Copy link
Contributor

Description

This pull request introduces two user-defined types for the following modules:

  • Deployment scripts -> (secure) environment variables (tagging module owner: @sebassem)
  • User Assigned Managed Identity -> federated identity credentials (tagging module owner: @elanzel)
  • Removed an unused line of code in .github/actions/templates/avm-validateModuleDeployment/action.yml

Extra context regarding @secure() decorator on user-defined type. When the Bicep template is built the type is referred as a secureString so the parameter inherits the secureString type and the parameter is secure during deployment:

Untitled

Also double checked if the outputs were working and tested it via this Bicep template:

/* Bicepparam
using './testsecureoutput.bicep'

param parTestingParameter = {
  secureList: [
    {
      name: 'test'
      secureValue: 'test123'
    }
  ]
}
*/

param parTestingParameter environmentVariableType

output outTestBool bool = parTestingParameter != null
output outTestArray array = parTestingParameter != null ? parTestingParameter!.secureList : []
output outTestArrayV2 array = parTestingParameter!.secureList ?? []
output outTestString string = first(parTestingParameter.secureList)!.secureValue!

@secure()
type environmentVariableType = {
  secureList: {
    name: string
    secureValue: string?
    value: string?
  }[]
}?

Pipeline Reference

avm.res.managed-identity.user-assigned-identity

avm.res.resources.deployment-script

Type of Change

  • Update to CI Environment or utlities (Non-module effecting changes)
  • Azure Verified Module updates:
    • 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

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

@johnlokerse johnlokerse requested review from a team as code owners March 9, 2024 14:34
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Mar 9, 2024
@johnlokerse
Copy link
Contributor Author

@AlexanderSehr FYI - had some issues with the randomised resource location selector on the deployment of the user-assigned managed identity. It deployed in eastasia, but that region does not support federated credentials. Maybe being able to override the location would be handy.

@AlexanderSehr
Copy link
Contributor

AlexanderSehr commented Mar 10, 2024

@AlexanderSehr FYI - had some issues with the randomised resource location selector on the deployment of the user-assigned managed identity. It deployed in eastasia, but that region does not support federated credentials. Maybe being able to override the location would be handy

Hey @johnlokerse,
that's indeed unfortunate as the location selector tries to only select regions where the resource exists, yet fails if certain features don't exist.
I worked around it in some other module recently by introducing an additional parameter to enforce a certain location

https://github.com/Azure/bicep-registry-modules/blob/a964d0c128afd8ccfe1d2ecbb3428868214cdf17/avm/res/purview/account/tests/e2e/max/main.test.bicep#L22-24

cc: @eriqua, @ChrisSidebotham fyi

@AlexanderSehr AlexanderSehr removed the Needs: Triage 🔍 Maintainers need to triage still label Mar 10, 2024
Copy link
Contributor

@sebassem sebassem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@AlexanderSehr AlexanderSehr self-requested a review March 11, 2024 18:07
@AlexanderSehr AlexanderSehr enabled auto-merge (squash) March 11, 2024 18:07
@AlexanderSehr AlexanderSehr dismissed their stale review March 11, 2024 18:07

It's my own. I shall dismiss

@AlexanderSehr AlexanderSehr merged commit 119dc6d into Azure:main Mar 11, 2024
9 checks passed
hundredacres pushed a commit to hundredacres/bicep-registry-modules that referenced this pull request Mar 12, 2024
## Description

This pull request introduces two user-defined types for the following
modules:
* Deployment scripts -> (secure) environment variables (tagging module
owner: @sebassem)
* User Assigned Managed Identity -> federated identity credentials
(tagging module owner: @elanzel)
* Removed an unused line of code in
`.github/actions/templates/avm-validateModuleDeployment/action.yml`

Extra context regarding `@secure()` decorator on user-defined type. When
the Bicep template is built the type is referred as a secureString so
the parameter inherits the secureString type and the parameter is secure
during deployment:

<img width="815" alt="Untitled"
src="https://github.com/Azure/bicep-registry-modules/assets/3514513/d2b8972f-6b34-46ed-b3d4-5c68437b263d">

Also double checked if the outputs were working and tested it via this
Bicep template:

```bicep
/* Bicepparam
using './testsecureoutput.bicep'

param parTestingParameter = {
  secureList: [
    {
      name: 'test'
      secureValue: 'test123'
    }
  ]
}
*/

param parTestingParameter environmentVariableType

output outTestBool bool = parTestingParameter != null
output outTestArray array = parTestingParameter != null ? parTestingParameter!.secureList : []
output outTestArrayV2 array = parTestingParameter!.secureList ?? []
output outTestString string = first(parTestingParameter.secureList)!.secureValue!

@secure()
type environmentVariableType = {
  secureList: {
    name: string
    secureValue: string?
    value: string?
  }[]
}?
```

## Pipeline Reference


[![avm.res.managed-identity.user-assigned-identity](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.managed-identity.user-assigned-identity.yml/badge.svg?branch=johnlokerse%2Fadd-udt-ds-uami)](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.managed-identity.user-assigned-identity.yml)


[![avm.res.resources.deployment-script](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.resources.deployment-script.yml/badge.svg?branch=johnlokerse%2Fadd-udt-ds-uami)](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.resources.deployment-script.yml)

## Type of Change

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

- [ ] Update to CI Environment or utlities (Non-module effecting
changes)
- [ ] Azure Verified Module updates:
- [ ] 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.
- [x] 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`.
  - [x] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants