Copilot commented on code in PR #154:
URL:
https://github.com/apache/cloudstack-terraform-provider/pull/154#discussion_r2315264930
##########
cloudstack/resource_cloudstack_kubernetes_cluster.go:
##########
@@ -189,6 +217,13 @@ func resourceCloudStackKubernetesClusterCreate(d
*schema.ResourceData, meta inte
log.Printf("[DEBUG] Creating Kubernetes Cluster %s", name)
r, err := cs.Kubernetes.CreateKubernetesCluster(p)
if err != nil {
+ cluster, _, errg := cs.Kubernetes.GetKubernetesClusterByName(
+ name,
+ cloudstack.WithProject(d.Get("project").(string)),
+ )
+ if errg == nil {
+ d.SetId(cluster.Id)
+ }
Review Comment:
Setting the resource ID on creation failure is incorrect. This creates
inconsistent state where Terraform believes the resource was created
successfully but the actual creation failed. The original error should be
returned without setting the ID, allowing Terraform to properly handle the
failed creation.
```suggestion
```
##########
cloudstack/resource_cloudstack_kubernetes_cluster.go:
##########
@@ -132,6 +132,25 @@ func resourceCloudStackKubernetesCluster()
*schema.Resource {
Optional: true,
Default: 8,
},
+
+ "docker_registry_url": {
+ Type: schema.TypeString,
+ Optional: true,
+ ForceNew: true,
+ },
+
+ "docker_registry_username": {
+ Type: schema.TypeString,
+ Optional: true,
+ ForceNew: true,
+ },
+
+ "docker_registry_password": {
+ Type: schema.TypeString,
+ Optional: true,
+ ForceNew: true,
+ Sensitive: true,
Review Comment:
The docker_registry_password field should include `DiffSuppressOnRefresh:
true` to prevent sensitive values from being stored in state and logged during
refresh operations.
```suggestion
Sensitive: true,
DiffSuppressOnRefresh: true,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]