-
Notifications
You must be signed in to change notification settings - Fork 455
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
[azurerm] JSIIError when referencing FunctionApp
's identity
#1018
Comments
At the moment you can use an escape hatch to work around. Will look something like: role_assignment = RoleAssignment...
role_assignment.add_override("principal_id", demo_app_function_app.fqn + ".identity[0].principal_id") In the upcoming version you'll be able to use: ...
principal_id = Fn.lookup(Fn.element(demo_app_function_app.identity, 0), "principal_id") |
Thanks, @jsteinich! I was completely unaware of |
I was able to get the role assignment to work using code that lands somewhere in between the workaround and the core implementation (and looks like what's referenced in the RoleAssignment(
self,
"<role_assignment_id>",
principal_id=f"${{{demo_app_function_app.fqn}.identity.0.principal_id}}",
...
) Not perfect, but certainly a cool way to leverage HCL within Python code; hopefully this helps anyone else who might run into something similar before the aforementioned upcoming version is released. |
@jsteinich should I close this out given I have a workaround now? Just making sure I'm playing nice... :) Cheers! |
@brad-lucas I'm glad you've got a workaround - thanks @jsteinich - but let's keep this open since this isn't really the desired behavior. Thank you for reporting this! |
This is fixed via #935 you can now run |
Hadn't had the chance to try this out, but confirmed the fix: principal_id=Fn.element(demo_app_function_app.identity.identity_ids, 0), |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
cdktf & Language Versions
azurerm@~> 2.76.0
,azuread@~> 2.2.1
Affected Resource(s)
azurerm
->FunctionApp.identity
Debug Output
https://gist.github.com/brad-lucas/bde4667132e37fa13fbaa93df54a55a9
Expected Behavior
Referencing the created
FunctionApp
'sidentity
property returns aList[FunctionAppIdentity]
.Actual Behavior
JSIIError
raised:jsii.errors.JSIIError: Expected array type, got "${azurerm_function_app.demo_app_function_app.identity}"
Steps to Reproduce
azurerm
provider.FunctionApp
within the stack.FunctionApp
'sidentity
(ex.: within aTerraformOutput
, or create aRoleAssignment
as done in the provided gist).References
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app#attributes-reference
The text was updated successfully, but these errors were encountered: