Skip to content

Commit 8010b2a

Browse files
authored
Merge pull request #50 from Rohit-Intel-Cloud/fix_nodegroup_import
fix nodegroup import issue for name, sshkeys
2 parents 48416cb + 4f88dbd commit 8010b2a

File tree

9 files changed

+43
-33
lines changed

9 files changed

+43
-33
lines changed

examples/gen-ai-xeon-opea-chatqna/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
required_providers {
33
intelcloud = {
4-
source = "intel/intelcloud"
5-
version = "0.0.9"
4+
source = "intel/intelcloud"
5+
version = "0.0.15"
66
}
77
}
88
}
@@ -28,14 +28,14 @@ provider "intelcloud" {
2828
# }
2929
# }
3030

31-
resource "intelcloud_sshkey" "example" {
32-
metadata = {
33-
name = var.ssh_key_name
34-
}
35-
spec = {
36-
ssh_public_key = file(var.ssh_pubkey_path)
37-
}
38-
}
31+
resource "intelcloud_sshkey" "example" {
32+
metadata = {
33+
name = var.ssh_key_name
34+
}
35+
spec = {
36+
ssh_public_key = file(var.ssh_pubkey_path)
37+
}
38+
}
3939

4040
resource "intelcloud_instance" "example" {
4141
name = var.instance_name

examples/gen-ai-xeon-opea-codegen/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
required_providers {
33
intelcloud = {
4-
source = "intel/intelcloud"
5-
version = "0.0.9"
4+
source = "intel/intelcloud"
5+
version = "0.0.15"
66
}
77
}
88
}

examples/resources/bucket_users/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
required_providers {
33
intelcloud = {
4-
source = "intel/intelcloud"
5-
version = "0.0.9"
4+
source = "intel/intelcloud"
5+
version = "0.0.15"
66
}
77
}
88
}

examples/resources/buckets/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
required_providers {
33
intelcloud = {
4-
source = "intel/intelcloud"
5-
version = "0.0.11"
4+
source = "intel/intelcloud"
5+
version = "0.0.15"
66
}
77
}
88
}

examples/resources/filesystems/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
intelcloud = {
44
source = "intel/intelcloud"
5-
version = "0.0.11"
5+
version = "0.0.15"
66
}
77
}
88
}

examples/resources/iks/create/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
intelcloud = {
55
source = "intel/intelcloud"
6-
version = "0.0.11"
6+
version = "0.0.15"
77
}
88
}
99
}
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
11
terraform {
22
required_providers {
33
intelcloud = {
4-
source = "intel/intelcloud"
5-
version = "0.0.9"
4+
source = "intel/intelcloud"
5+
version = "0.0.15"
66
}
77
}
88
}
99

1010

1111
provider "intelcloud" {
12-
region = "us-region-1"
12+
region = "us-region-2"
1313
}
1414

1515
locals {
16-
# name = "${random_pet.prefix.id}"
17-
name = "testdemo97"
18-
availability_zone = "us-region-1a"
16+
name = random_pet.prefix.id
17+
availability_zone = "us-region-2a"
1918
tags = {
2019
environment = "Demo"
2120
}
2221
}
2322

24-
resource "idc_iks_node_group" "ng1" {
25-
cluster_uuid = "cl-lc2ze6pu4i"
23+
resource "intelcloud_iks_node_group" "ng1" {
24+
cluster_uuid = "<your-cluster-uuid>"
2625
name = "${local.name}-ng"
2726
node_count = 2
2827
node_type = "vm-spr-sml"
2928
userdata_url = ""
30-
ssh_public_key_names = ["shrimac"]
31-
interfaces = [{
32-
name = "us-staging-3a"
33-
vnet = "us-staging-3a-default"
34-
}]
29+
ssh_public_key_names = ["rk-win-key"]
3530
}
3631

3732
output "iks_order" {
38-
value = idc_iks_node_group.ng1
33+
value = intelcloud_iks_node_group.ng1
3934
}

examples/resources/instances/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
intelcloud = {
44
source = "intel/intelcloud"
5-
version = "0.0.11"
5+
version = "0.0.15"
66
}
77
}
88
}

internal/provider/iks_node_group_resource.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,13 @@ func (r *iksNodeGroupResource) Create(ctx context.Context, req resource.CreateRe
192192
}
193193

194194
plan.ClusterUUID = types.StringValue(nodeGroupResp.ClusterID)
195+
plan.Name = types.StringValue(nodeGroupResp.Name)
195196
plan.ID = types.StringValue(nodeGroupResp.ID)
196197
plan.IMIId = types.StringValue(nodeGroupResp.IMIID)
197198
plan.State = types.StringValue(nodeGroupResp.State)
199+
plan.Count = types.Int64Value(nodeGroupResp.Count)
198200
plan.NodeType = types.StringValue(nodeGroupResp.InstanceType)
201+
plan.UserDataURL = types.StringValue(nodeGroupResp.UserDataURL)
199202
vnets := []models.NetworkInterfaceSpec{}
200203
for _, iface := range nodeGroupResp.Interfaces {
201204
v := models.NetworkInterfaceSpec{
@@ -212,6 +215,11 @@ func (r *iksNodeGroupResource) Create(ctx context.Context, req resource.CreateRe
212215
}
213216
plan.Vnets = vnetObj
214217

218+
plan.SSHPublicKeyNames = []types.String{}
219+
for _, k := range nodeGroupResp.SSHKeyNames {
220+
plan.SSHPublicKeyNames = append(plan.SSHPublicKeyNames, types.StringValue(k.Name))
221+
}
222+
215223
// Set state to fully populated data
216224
diags = resp.State.Set(ctx, plan)
217225
resp.Diagnostics.Append(diags...)
@@ -251,11 +259,13 @@ func (r *iksNodeGroupResource) Read(ctx context.Context, req resource.ReadReques
251259
}
252260

253261
state.ClusterUUID = types.StringValue(ngState.ClusterID)
262+
state.Name = types.StringValue(ngState.Name)
254263
state.ID = types.StringValue(ngState.ID)
255264
state.IMIId = types.StringValue(ngState.IMIID)
256265
state.State = types.StringValue(ngState.State)
257266
state.Count = types.Int64Value(ngState.Count)
258267
state.NodeType = types.StringValue(ngState.InstanceType)
268+
state.UserDataURL = types.StringValue(ngState.UserDataURL)
259269

260270
vnets := []models.NetworkInterfaceSpec{}
261271
for _, i := range ngState.Interfaces {
@@ -273,6 +283,11 @@ func (r *iksNodeGroupResource) Read(ctx context.Context, req resource.ReadReques
273283
}
274284
state.Vnets = vnetObj
275285

286+
state.SSHPublicKeyNames = []types.String{}
287+
for _, k := range ngState.SSHKeyNames {
288+
state.SSHPublicKeyNames = append(state.SSHPublicKeyNames, types.StringValue(k.Name))
289+
}
290+
276291
// Set state to fully populated data
277292
diags = resp.State.Set(ctx, &state)
278293
resp.Diagnostics.Append(diags...)

0 commit comments

Comments
 (0)