For resources that are lists, such as Azure FunctionAppIdentity, how do you reference indexes properly in Python? For example:
function = FunctionApp(self, ... identity=[FunctionAppIdentity(type="SystemAssigned")], ...
# this is how you'd ref the identity principal_id in HCL:
# this errors with raise AttributeError("'%s' object has no attribute '%s'" % (type_info, name))
object_id = function.identity.principal_id
Sorry for the delayed response. This appears to be a bug specific to
principal_id and other nested block properties that can’t be set.
It would be great if you could file an issue so that you get updates on progress made towards fixing this.
Thank you @jsteinich for the response. I have run into this for other resources, so just assumed I was referencing incorrectly. I will file an issue.
There are times where you’ll need to use tokens, but ideally how you’re referencing things should work.
principal_id property doesn’t exist on the generated
FunctionAppIdentity so it isn’t directly referenceable. This is pretty similar to https://github.com/aws/jsii/issues/1841, but is slightly different in that some properties actually do exist for configuration.
If you are still stuck on this, it should be possible to use an escape hatch to reference it.