-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Enhancement: azurerm_private_endpoint
expose private_ip_address
as computed attribute
#5838
Conversation
private_ip_address
for azurerm_private_endpoint
azurerm_private_endpoint
expose private_ip_address
as computed attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njuCZ , thanks for PR... I had a look while this mostly LGTM the is one minor change I would like to see made. Thanks again for the PR! 🚀
for _, item := range flattenedConnection { | ||
v := item.(map[string]interface{}) | ||
v["private_ip_address"] = privateIpAddress | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to loop over the returned slice you just need to append the value to it if the privateIpAddress
is not empty, something like the below... WDYT?
if privateIpAddress != "" {
privateIp := make(map[string]interface{})
privateIp["private_ip_address"] = privateIpAddress
flattenedConnection = append(flattenedConnection, privateIp)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WodansSon the flattenedConnection
is a list of map, append it with another map will cause flattenedConnection
has two maps, not a merged map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njuCZ I got the iteration mixed up in my head... you're right... this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @njuCZ this LGTM! 🚀
for _, item := range flattenedConnection { | ||
v := item.(map[string]interface{}) | ||
v["private_ip_address"] = privateIpAddress | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njuCZ I got the iteration mixed up in my head... you're right... this is fine.
This has been released in version 2.1.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.1.0"
}
# ... other configuration ... |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
fixes #5622
fixes #5208
add
private_ip_address
just like data sourceazurerm_private_endpoint_connection
.Because
azurerm_private_link_endpoint
use the same flatten function, So I set this field outside this flatten function