For Azure, Private Endpoint resource , private_ip_address is a computed value.
For Private DNS A Record , only IP address is allowed.
Is there a way that I can fetch the computed value(private_ip_address) and use it in Private DNS A Record .
(records = [azurerm_private_endpoint.example.private_ip_address])
If i try to use it like an attribute , I get an error.
Object does not have an attribute named private_ip_address.
The error you saw here is not an error related to computed values. It seems like something else is going on here, but I can’t say what it would be without seeing your full configuration. Can you share what you’ve written in a comment here (you can use the “<>” icon in the editor toolbar to mark it as code so it’ll be readable) and also share the full text of the error message you saw, so it’s obvious exactly which part of the configuration the error is referring to?
I am looping a list of Private Endpoints. Trying to create both a private endpoint and add a DNS A Record.
Key is the private endpoint name.
Also I am able to access the id parameter but not private_ip_address.
I have edited the text a bit. Let me know if you need any more clarifications
Below is the error message
Error: Unsupported attribute
records = [azurerm_private_endpoint.apre[each.key].private_ip_address]
azurerm_private_endpoint.apre is an object with 1 attribute "priv_endpt_nm"
each.key is "priv_endpt_nm"
This object does not have an attribute named "private_ip_address"
Hi again, @sam! Thanks for the additional context.
I must admit that I’m not at all familar with these AzureRM provider features, so I’m guessing a bit here. With that said, I’m looking at the azurerm_private_endpoint documentation and it seems like private_ip_address is an attribute belonging to nested private_service_connection blocks rather than directly to the resource instance object, so I think to access it you will need to traverse to that block first: