You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. Please implement a depends_on option for Data Source: azurerm_public_ip. This option can help to use the output of the first Data Source as the input arguments for the next Data Sources
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.
Description
Hi. Please implement a depends_on option for Data Source: azurerm_public_ip (https://registry.terraform.io/providers/hashicorp/Azurerm/latest/docs/data-sources/public_ip). Why? I try to explain in a few words. You should enter the name of the public IP address and resource_group_name arguments to fetch an ip_address attribute. I've met a case when Terraform did not create this IP address. I don't have this resource and its name in the Terraform configuration files. So I applied Data Source: azurerm_resources using required_tags to fetch this name of the public IP resource from Azure Portal at the beginning and then to use this name as an argument in Data Source: azurerm_public_ip.
It looks like the following part of the code:
data "azurerm_resources" "public_ip_name" {
resource_group_name = "example-resources"
required_tags = {
environment = "production"
role = "webserver"
}
}
output "public_ip_name" {
value = data.azurerm_resources.public_ip_name.name
}
data "azurerm_public_ip" "public_ip_address" {
name = data.azurerm_resources.public_ip_name.name
resource_group_name = "example-resources"
}
output "public_ip_address" {
value = data.azurerm_public_ip.public_ip_address.ip_address
}
As a result, I've received an error that the name argument is not defined. It seems to me that the second Data Source started to look for public_ip_address before the first Data Source retrieved the name from Azure Portal. I guess using a depend_on option in the second Data could solve this issue. Would you implement this option for Data Source? Thank You.
P.S. Import this public IP resource into the Terraform file is not allowed
Is there an existing issue for this?
Community Note
Hi. Please implement a depends_on option for Data Source: azurerm_public_ip. This option can help to use the output of the first Data Source as the input arguments for the next Data Sources
Description
Hi. Please implement a depends_on option for Data Source: azurerm_public_ip (https://registry.terraform.io/providers/hashicorp/Azurerm/latest/docs/data-sources/public_ip). Why? I try to explain in a few words. You should enter the name of the public IP address and resource_group_name arguments to fetch an ip_address attribute. I've met a case when Terraform did not create this IP address. I don't have this resource and its name in the Terraform configuration files. So I applied Data Source: azurerm_resources using required_tags to fetch this name of the public IP resource from Azure Portal at the beginning and then to use this name as an argument in Data Source: azurerm_public_ip.
It looks like the following part of the code:
data "azurerm_resources" "public_ip_name" {
resource_group_name = "example-resources"
required_tags = {
environment = "production"
role = "webserver"
}
}
output "public_ip_name" {
value = data.azurerm_resources.public_ip_name.name
}
data "azurerm_public_ip" "public_ip_address" {
name = data.azurerm_resources.public_ip_name.name
resource_group_name = "example-resources"
}
output "public_ip_address" {
value = data.azurerm_public_ip.public_ip_address.ip_address
}
As a result, I've received an error that the name argument is not defined. It seems to me that the second Data Source started to look for public_ip_address before the first Data Source retrieved the name from Azure Portal. I guess using a depend_on option in the second Data could solve this issue. Would you implement this option for Data Source? Thank You.
P.S. Import this public IP resource into the Terraform file is not allowed
New or Affected Resource(s)/Data Source(s)
data.azurerm_public_ip
Potential Terraform Configuration
References
No response
The text was updated successfully, but these errors were encountered: