Skip to content
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

Fix default tag checking for vultr_kubernetes resource #528

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions vultr/resource_vultr_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,21 @@ func resourceVultrKubernetesRead(ctx context.Context, d *schema.ResourceData, me
}

// Look for the node pool with the tag `tf-vke-default`
found := false
for i := range vke.NodePools {
if tfVKEDefault == vke.NodePools[i].Tag {
if err := d.Set("node_pools", flattenNodePool(&vke.NodePools[i])); err != nil {
return diag.Errorf("unable to set resource kubernetes `node_pools` read value: %v", err)
}
found = true
break
} else {
// no node pool with the default tag was found. mostly only relevant to importing
return diag.Errorf(`unable to set resource kubernetes default node pool with tag %s for %v.
You must set the default tag on one node pool before importing.`,
tfVKEDefault, d.Id())
}
}
if !found {
return diag.Errorf(`unable to set resource kubernetes default node pool with tag %s for %v.
You must set the default tag on one node pool before importing.`,
tfVKEDefault, d.Id())
}

if err := d.Set("region", vke.Region); err != nil {
return diag.Errorf("unable to set resource kubernetes `region` read value: %v", err)
Expand Down
Loading