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
I have a azurerm_public_ip and a azurerm_bastion_host to which the pip is associated with.
I want to rename the name of the pip resource to follow our standard practices.
Our consumers who are updating their versions to new module call (with new names) are expected to experience a delete and recreate. But all of this should happen in our ci/cd pipelines and consumers should not have to go to azure portal to make any changes.
But the problem we have is since the pip is already associated to bastion host that should be force replaced as well bt it is only getting updated in place. Because of this the terraform apply fails.
The only workaround seems to be to go to azure portal and delete the bastion host manually and then run a terraform apply.
Community Note
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
# Copy-paste your Terraform configurations here - for large Terraform configs,# please use a service like Dropbox and share a link to the ZIP file. For# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
Debug Output
# module.bastion_host.module.bastion_host["eastus"].azurerm_bastion_host.bastion_host will be updated in-place
~ resource "azurerm_bastion_host" "bastion_host" {
id = "/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/bastionHosts/dojo-networking-bastion-default-bastion-upgrade"
name = "dojo-networking-bastion-default-bastion-upgrade"
~ tags = {
~ "DojoVersion" = "v3.0.x" -> "v4.0.x"
# (10 unchanged elements hidden)
}
# (3 unchanged attributes hidden)
~ ip_configuration {
~ name = "bastion_configuration" -> "bastion_ip_config"
~ public_ip_address_id = "/subscriptions/xxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/publicIPAddresses/dojo-networking-bastion-default-bastion-upgrade" -> (known after apply)
# (1 unchanged attribute hidden)
}
}
# module.bastion_host.module.bastion_host_pip["eastus"].azurerm_public_ip.pip must be replaced
-/+ resource "azurerm_public_ip" "pip" {
+ fqdn = (known after apply)
~ id = "/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/publicIPAddresses/dojo-networking-bastion-default-bastion-upgrade" -> (known after apply)
~ ip_address = "xxxxxx" -> (known after apply)
~ name = "dojo-networking-bastion-default-bastion-upgrade" -> "dojo-networking-bastion-default-bastion-pip-upgrade" # forces replacement
~ tags = {
~ "DojoVersion" = "v3.0.x" -> "v4.0.x"
# (10 unchanged elements hidden)
}
- zones = [] -> null
# (6 unchanged attributes hidden)
}
terraform apply -auto-approve
Acquiring state lock. This may take a few moments...
azurerm_resource_group.rg: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade]
module.virtual_network.module.virtual_network["eastus"].azurerm_virtual_network.vnet: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/virtualNetworks/dojo-networking-bastion-default-vnet-upgrade]
module.bastion_host.module.bastion_host_subnet["eastus"].azurerm_subnet.subnet["AzureBastionSubnet"]: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/virtualNetworks/dojo-networking-bastion-default-vnet-upgrade/subnets/AzureBastionSubnet]
module.bastion_host.module.bastion_host_pip["eastus"].azurerm_public_ip.pip: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/publicIPAddresses/dojo-networking-bastion-default-bastion-upgrade]
module.bastion_host.module.bastion_host_nsg["eastus"].azurerm_network_security_group.nsg: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/networkSecurityGroups/dojo-networking-bastion-default-bastion-nsg-upgrade]
module.bastion_host.module.bastion_host_nsg_assoc["eastus"].azurerm_subnet_network_security_group_association.nsg_assoc: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/virtualNetworks/dojo-networking-bastion-default-vnet-upgrade/subnets/AzureBastionSubnet]
module.bastion_host.module.bastion_host["eastus"].azurerm_bastion_host.bastion_host: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/bastionHosts/dojo-networking-bastion-default-bastion-upgrade]
module.bastion_host.module.diagnostics.module.bastion_host_diagnostics_setting["eastus"].azurerm_monitor_diagnostic_setting.diagnostic_setting[0]: Refreshing state... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/bastionHosts/dojo-networking-bastion-default-bastion-upgrade|dojo-networking-bastion-default-bastion-upgrade-ds]
module.bastion_host.module.bastion_host_pip["eastus"].azurerm_public_ip.pip: Destroying... [id=/subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/publicIPAddresses/dojo-networking-bastion-default-bastion-upgrade]
Error: Error deleting Public IP "dojo-networking-bastion-default-bastion-upgrade" (Resource Group "dojo-networking-bastion-default-upgrade"): network.PublicIPAddressesClient#Delete: Failure sending request: StatusCode=400 -- Original Error: Code="PublicIPAddressCannotBeDeleted" Message="Public IP address /subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/publicIPAddresses/dojo-networking-bastion-default-bastion-upgrade can not be deleted since it is still allocated to resource /subscriptions/xxxx/resourceGroups/dojo-networking-bastion-default-upgrade/providers/Microsoft.Network/bastionHosts/dojo-networking-bastion-default-bastion-upgrade/bastionHostIpConfigurations/bastion_configuration. In order to delete the public IP, disassociate/detach the Public IP address from the resource. To learn how to do this, see aka.ms/deletepublicip." Details=[]
Panic Output
Expected Behaviour
Changing the name of pip resource shoudl cause force replacement of all bastion host resources to which the pip is associated as well
Actual Behaviour
Renaming pip only force replaces pip resources and not the associated bastion host, since the pip is already associated to bastion host terraform apply fails stating already associated
Steps to Reproduce
create a bastion pip resource
create a bastion host resource and associate the above created pip to it.
run terraform plan and apply -> success
now rename the pip resource to a different value.
run terraform plan -> will show pip will be force replaced, bastion host will be updated in place.
run terraform apply -> will fail with error stating pip already associated to bastino host.
Important Factoids
References
#0000
The text was updated successfully, but these errors were encountered:
Fixes:
hashicorp#10600
Add ForceNew fields to values in IP Configuration for Bastion Host resource:
Name
Subnet ID
Public IP Address ID
Behaviour then is like for like with Azure Portal where a user has to rebuild Bastion Hosts.
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 have 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.
Hi,
Community Note
Terraform (and AzureRM Provider) Version
terraform --version
Terraform v0.14.0
Affected Resource(s)
azurerm_XXXXX
Terraform Configuration Files
Debug Output
Panic Output
Expected Behaviour
Actual Behaviour
Steps to Reproduce
Important Factoids
References
The text was updated successfully, but these errors were encountered: