Allow `getSecret()` to be used with `@secure()` objects
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 81
Description
**Bicep version**
Bicep CLI version 0.11.1 (030248df55)
**Describe the bug**
I am not able to use keyvault getSecret with secure object params passed directly to module.
**To Reproduce**
-----------------------------------------------------------------------------------
This code snippet works:
main.bicep
```
module testmodule 'testmodule.bicep' = {
name: 'testmodule'
params: {
linuxPassword: kv.getSecret('linuxPassword')
}
}
```
testmodule.bicep
```
@secure()
param linuxPassword string
```
------------------------------------------------------------------------------------
This snippet does not:
main.bicep
```
module testmodule 'testmodule.bicep' = {
name: 'testmodule'
params: {
config: {
linuxPassword: kv.getSecret('linuxPassword')
SomeOtherConfigParam1: kv.getSecret('foo')
SomeOtherConfigParam2: kv.getSecret('boo')
}
}
}
```
testmodule.bicep
```
@secure()
param config object
```
It yields with an error
`Function "getSecret" is not valid at this location. It can only be used when directly assigning to a module parameter with a secure decorator.bicep(BCP180)`
**Additional context**
I need to pass dozens of app settings as secure params to the module and I was hoping this would work.
Those settings have nested structure.
Is bicep really supporting only basic types as string, bool, array for keyvault getSecret() function?
Any hints here Guys?
Contributor guide
Research direction
Start by reproducing the BCP180 diagnostic with main.bicep and testmodule.bicep from the issue, comparing the direct linuxPassword assignment with the nested config object. Trace the compiler validation for getSecret() and secure module parameters. Done means getSecret() is accepted inside an object passed to an @secure() object parameter while the existing direct-parameter behavior remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100