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

[BUG] Unable to expand resources because the source file when using listkeys() #2829

Closed
sebassem opened this issue Apr 22, 2024 · 3 comments · Fixed by #2831
Closed

[BUG] Unable to expand resources because the source file when using listkeys() #2829

sebassem opened this issue Apr 22, 2024 · 3 comments · Fixed by #2831
Assignees
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Milestone

Comments

@sebassem
Copy link
Contributor

Existing rule

No response

Description of the issue

I have the following code using the keyVault AVM module and trying to reference a storage account key

secrets: { secureList: [ { name: storageRef.name value: storageRef.listKeys().keys[0].value attributesExp: 1702648632 attributesNbf: 10000 } ] }
When PSRule runs I always get this error :

Failed to expand bicep source '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/ptn/finops-toolkit/finops-hub/tests/e2e/defaults/main.test.bicep'. Exception calling "GetBicepResources" with "2" argument(s): "Unable to expand resources because the source file '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/ptn/finops-toolkit/finops-hub/tests/e2e/defaults/main.test.bicep' was not valid. An error occurred evaluating expression '[parameters('value')]' line 9939. The parameter named 'value' was not set or a defaultValue was defined."

Error messages

Failed to expand bicep source '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/ptn/finops-toolkit/finops-hub/tests/e2e/defaults/main.test.bicep'. Exception calling "GetBicepResources" with "2" argument(s): "Unable to expand resources because the source file '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/ptn/finops-toolkit/finops-hub/tests/e2e/defaults/main.test.bicep' was not valid. An error occurred evaluating expression '[parameters('value')]' line 9939. The parameter named 'value' was not set or a defaultValue was defined."

Reproduction

https://github.com/sebassem/bicep-registry-modules/actions/workflows/avm.ptn.finops-toolkit.finops-hub.yml

Version of PSRule

2.9.0

Version of PSRule for Azure

No response

Additional context

No response

@sebassem sebassem added bug Something isn't working Needs: Triage 🔍 labels Apr 22, 2024
@BernieWhite BernieWhite added feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep. and removed Needs: Triage 🔍 labels Apr 22, 2024
@sebassem
Copy link
Contributor Author

Hey @BernieWhite, do we have a fix for this in an upcoming release? I'm asking as we are getting similar issues in AVM pattern modules..

@BernieWhite BernieWhite self-assigned this Apr 24, 2024
@BernieWhite BernieWhite added this to the v1.36.0 milestone Apr 24, 2024
@BernieWhite
Copy link
Collaborator

Hi @sebassem, yes, initial investigation is done and I am working on a fix. There is a bit of complexity to this issue, but I hope to close this issue in the next day or so followed with a pre-release.

If you have another similar issue that you think is related to a similar pattern of listKeys() or other secret value please feel free to reference the actions run in this issue and I'll double check we have a fix for that as well.

If you feel that the issue is unrelated maybe add another issue so we can track it separately.

@sebassem
Copy link
Contributor Author

Thanks Bernie, the other issue I'm facing is a little bit different so I will submit another one

BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Apr 25, 2024
This was referenced Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants