Skip to content

Commit 3766bf0

Browse files
committed
KUBE-1116: adding update logic for gke_cluster_id
1 parent 9e181e9 commit 3766bf0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

castai/resource_gke_cluster_id.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ func resourceCastaiGKEClusterIdCreate(ctx context.Context, data *schema.Resource
118118
return diag.FromErr(err)
119119
}
120120
if err := data.Set(FieldClusterToken, tkn); err != nil {
121-
return diag.FromErr(fmt.Errorf("setting cluster token: %w", err))
121+
return diag.FromErr(fmt.Errorf("setting cluster token: %v", err))
122122
}
123123
data.SetId(clusterID)
124124
// If client service account is set, create service account on cast side.
125125
if len(data.Get(FieldGKEClientSA).(string)) > 0 {
126126
if err := createCastServiceAccount(ctx, client, data); err != nil {
127-
return diag.FromErr(fmt.Errorf("[ERROR] Creating Cast service account %w", err))
127+
return diag.FromErr(fmt.Errorf("[ERROR] Creating Cast service account %v", err))
128128
}
129129
}
130130
return nil
@@ -134,12 +134,9 @@ func resourceCastaiGKEClusterIdRead(ctx context.Context, data *schema.ResourceDa
134134
client := meta.(*ProviderConfig).api
135135

136136
if data.Id() == "" {
137-
tflog.Info(ctx, ("[INFO] id is null not fetching anything."))
137+
tflog.Info(ctx, "id is null, not fetching anything.")
138138
return nil
139139
}
140-
oldValue, newValue := data.GetChange(FieldGKEClientSA)
141-
tflog.Info(ctx, fmt.Sprintf("Value of FieldGKEClientSA in state: %v %v", data.Get(FieldGKEClientSA), data.Get(FieldGKEClusterIdLocation)))
142-
tflog.Info(ctx, fmt.Sprintf("2 Value of FieldGKEClientSA in state: %v %v", oldValue, newValue))
143140

144141
log.Printf("[INFO] Getting cluster information.")
145142
resp, err := fetchClusterData(ctx, client, data.Id())
@@ -176,7 +173,7 @@ func resourceCastaiGKEClusterIdUpdate(ctx context.Context, data *schema.Resource
176173
func resourceCastaiGKEClusterIdDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
177174
// Disable service account used for impersonation.
178175
client := meta.(*ProviderConfig).api
179-
tflog.Info(ctx, " Disabling service account.")
176+
tflog.Info(ctx, "Disabling service account.")
180177
_, err := client.ExternalClusterAPIDisableGKESA(ctx, data.Id())
181178
if err != nil {
182179
return diag.FromErr(fmt.Errorf("disabling service account: %w", err))

0 commit comments

Comments
 (0)