Closed arteonprifti closed 3 years ago
Work in progress. Issue was identified in the Terraform code: wrong validation of number of elements in the publicIps array.
Solved in version 1.5.12.
https://registry.terraform.io/providers/ionos-cloud/profitbricks/latest
@arteonprifti - please note that removing public_ips can now be done by simply providing an empty public_ips list i.e.
public_ips = []
Omitting the field altogether, will NOT remove it, it'll leave it unchanged, this behavior being consistent with every other update operation.
Terraform Version
Terraform v0.13.3
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
public_ips should get removed
Actual Behavior
terraform returns changed, but the public_ips are not removed
Steps to Reproduce
Start with 2 nodes (no autoscaling) and 3 public_ips as base setup (works of course)
Change 2->1 nodes and 3->2 public_ips works (if you don’t change the ip_block size, you will see one free CRIP in DCD)
Change to empty list for public_ips fails during plan phase: “Error: public_ips: attribute supports 2 item as a minimum, config has 0 declared” This is OK: https://github.com/ionos-cloud/terraform-provider-profitbricks/blob/master/profitbricks/resource_profitbricks_k8s_node_pool.go (line 126 ff) specifies that if public_ips is provided, it must have at least 2 entries. Thus you have to provide min 2 IPS or completely omit the public_ips property. Which leads to …
Remove public_ips completely. This shows the described wrong behavior, i.e. silently doing nothing. This is caused by a missing else block in the code (line 319ff): The public_ips are only updated if they are provided (‘if newPublicIps != nil’). If they are omitted, newPublicIps is nil and this is not covered by the code.