Fix cluster network mapping (#375)

* Make cluster network computed

* Replace computed with better mapping

* Fix comment

* Update unit test§
This commit is contained in:
Vicente Pinto 2024-05-27 09:18:10 +01:00 committed by GitHub
parent 35b10c602b
commit ecaf622f55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 7 deletions

View file

@ -1486,6 +1486,17 @@ func mapNetwork(cl *ske.Cluster, m *Model) error {
return nil
}
// If the network field is not provided, the SKE API returns an empty object.
// If we parse that object into the terraform model, it will produce an inconsistent result after apply error
emptyNetwork := &ske.V1Network{}
if *cl.Network == *emptyNetwork && m.Network.IsNull() {
if m.Network.Attributes() == nil {
m.Network = types.ObjectNull(networkTypes)
}
return nil
}
id := types.StringNull()
if cl.Network.Id != nil {
id = types.StringValue(*cl.Network.Id)