-
Notifications
You must be signed in to change notification settings - Fork 123
Add write-only password support to elasticsearch_security_user resource #1419
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
Conversation
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
…able Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
…ons, fix password_wo version logic Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
|
@copilot |
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
| ) | ||
|
|
||
| func (r *userResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { | ||
| resp.Diagnostics.Append(r.update(ctx, req.Plan, req.Config, &resp.State)...) |
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.
nit-pick: While the current approach works, I think having separate Create and Update implementations would be simpler. Maybe we can adjust the Copilot rules to enforce this.
dimuon
left a comment
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.
Besides a few nit-picks and one missing check for nil, LGTM.
Migration Plan: elasticsearch_security_user to Plugin Framework + Write-Only Attributes
Phase 1: Migrate from SDKv2 to Plugin Framework ✅
internal/elasticsearch/security/user/system_userpatternuser_test.gotouser/acc_test.goTestAccResourceSecurityUserFromSDKtest for seamless migrationprovider/plugin_framework.goprovider/provider.gouser_shared.gofor data source compatibilityuser.goanduser_test.gofilesPhase 2: Add Write-Only Attribute Support ✅
password_woandpassword_wo_versionattributes to schemapassword_woandpassword_wo_versionTestAccResourceSecurityUserWithPasswordWoacceptance testPhase 3: Address PR Review Feedback ✅
ConflictsWith,PreferWriteOnlyAttribute, andAlsoRequiresvalidatorsSizeAtLeast(1)validator for rolesPutUserandDeleteUserto return Framework diagnostics directlypassword_wofrom config instead of plan (per Terraform write-only guidelines)Summary
Successfully migrated
elasticsearch_security_userresource from Terraform SDKv2 to Plugin Framework and added write-only password support for ephemeral resources.Key Features:
password_woandpassword_wo_versionattributes allow using ephemeral resources (like Vault secrets) without storing passwords in statePutUserandDeleteUserfunctionspassword_wofrom config rather than planTesting:
Original prompt
elasticsearch_security_user#1295💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.