-
Notifications
You must be signed in to change notification settings - Fork 48
CKS registry and state updates #154
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
base: main
Are you sure you want to change the base?
Conversation
…ion for better state
@JSpon also can you add the documentation for the parameters |
@JSpon Please you update the documentation as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Docker registry credential support to CloudStack Kubernetes cluster creation and improves error handling by attempting to retrieve cluster information when creation fails.
- Adds three new optional schema fields for Docker registry credentials (URL, username, password)
- Sets Docker registry parameters in the creation request when provided
- Implements error recovery by attempting to retrieve cluster information on creation failure
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
cluster, _, errg := cs.Kubernetes.GetKubernetesClusterByName( | ||
name, | ||
cloudstack.WithProject(d.Get("project").(string)), | ||
) | ||
if errg == nil { | ||
d.SetId(cluster.Id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
cluster, _, errg := cs.Kubernetes.GetKubernetesClusterByName( | |
name, | |
cloudstack.WithProject(d.Get("project").(string)), | |
) | |
if errg == nil { | |
d.SetId(cluster.Id) | |
} |
Copilot uses AI. Check for mistakes.
"docker_registry_password": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ForceNew: true, | ||
Sensitive: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker_registry_password field should include DiffSuppressOnRefresh: true
to prevent sensitive values from being stored in state and logged during refresh operations.
"docker_registry_password": { | |
Type: schema.TypeString, | |
Optional: true, | |
ForceNew: true, | |
Sensitive: true, | |
Sensitive: true, | |
DiffSuppressOnRefresh: true, |
Copilot uses AI. Check for mistakes.
Add registry credentials to cks creation, and caàtch failures on creation on for better state