Skip to content

Commit 3fc7b05

Browse files
committed
move private_ips as a node attribute + handle 403 + cassettes
1 parent 6dc2ff3 commit 3fc7b05

13 files changed

+21098
-20793
lines changed

docs/resources/k8s_pool.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ In addition to all arguments above, the following attributes are exported:
107107
- `status` - The status of the pool.
108108
- `nodes` - (List of) The nodes in the default pool.
109109
- `name` - The name of the node.
110+
- `private_ips` - The list of private IPv4 and IPv6 addresses associated with the node.
111+
- `id` - The ID of the IP address resource.
112+
- `address` - The private IP address.
110113
- `public_ip` - The public IPv4. (Deprecated, Please use the official Kubernetes provider and the kubernetes_nodes data source)
111114
- `public_ip_v6` - The public IPv6. (Deprecated, Please use the official Kubernetes provider and the kubernetes_nodes data source)
112115
- `status` - The status of the node.
113-
- `private_ips` - The list of private IPv4 and IPv6 addresses associated with the node.
114-
- `id` - The ID of the IP address resource.
115-
- `address` - The private IP address.
116116
- `created_at` - The creation date of the pool.
117117
- `updated_at` - The last update date of the pool.
118118
- `version` - The version of the pool.

internal/services/k8s/helpers_k8s.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@ func getClusterProjectID(ctx context.Context, k8sAPI *k8s.API, pool *k8s.Pool) (
131131
if cluster.ProjectID == "" {
132132
return "", fmt.Errorf("no project ID found for cluster %s", pool.ClusterID)
133133
}
134+
134135
return cluster.ProjectID, nil
135136
}

internal/services/k8s/pool.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ func ResourceK8SPoolRead(ctx context.Context, d *schema.ResourceData, m interfac
427427

428428
// Get nodes' private IPs
429429
diags := diag.Diagnostics{}
430+
430431
projectID, err := getClusterProjectID(ctx, k8sAPI, pool)
431432
if err != nil {
432433
diags = append(diags, diag.Diagnostic{
@@ -459,6 +460,7 @@ func ResourceK8SPoolRead(ctx context.Context, d *schema.ResourceData, m interfac
459460
Summary: "Unauthorized to read nodes' private IPs, please check your IAM permissions",
460461
Detail: err.Error(),
461462
})
463+
462464
break
463465
} else {
464466
diags = append(diags, diag.Diagnostic{

internal/services/k8s/testdata/cluster-multicloud.cassette.yaml

Lines changed: 4156 additions & 677 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/data-source-pool-basic.cassette.yaml

Lines changed: 2140 additions & 1305 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/pool-basic.cassette.yaml

Lines changed: 1431 additions & 3930 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/pool-kubelet-args.cassette.yaml

Lines changed: 1020 additions & 920 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/pool-placement-group.cassette.yaml

Lines changed: 3231 additions & 4064 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/pool-public-ip-disabled.cassette.yaml

Lines changed: 2113 additions & 2260 deletions
Large diffs are not rendered by default.

internal/services/k8s/testdata/pool-size.cassette.yaml

Lines changed: 1075 additions & 2937 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)