Feat/alpa postgres user (#14)

* chore: add stackit_postgresflexalpha_user resource

* chore: refactor postgresflex user resource to postgresflexalpha

* chore: refactor wait handlers and update API client interfaces for postgresflexalpha

* chore: add stackit_postgresflexalpha_user data source example

* fix: refactor sqlserverflexalpha user resource and enhance schema with status and default_database

---------

Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
This commit is contained in:
Marcel S. Henselin 2025-12-22 10:02:25 +01:00 committed by GitHub
parent f0414ab3b9
commit 6aac685ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 22 deletions

View file

@ -144,7 +144,8 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) { t.Run(
tt.desc, func(t *testing.T) {
instanceId := "foo-bar" instanceId := "foo-bar"
apiClient := &apiClientInstanceMocked{ apiClient := &apiClientInstanceMocked{
@ -220,7 +221,8 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) { t.Run(
tt.desc, func(t *testing.T) {
instanceId := "foo-bar" instanceId := "foo-bar"
apiClient := &apiClientInstanceMocked{ apiClient := &apiClientInstanceMocked{
@ -376,7 +378,7 @@ func TestDeleteUserWaitHandler(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) { t.Run(tt.desc, func(t *testing.T) {
userId := int64(1001) userId := "foo-bar"
apiClient := &apiClientUserMocked{ apiClient := &apiClientUserMocked{
getFails: tt.getFails, getFails: tt.getFails,

View file

@ -1,3 +1,9 @@
data "stackit_postgresflexalpha_user" "example" {
project_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.project_id
instance_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.id
user_id = 1
}
resource "stackit_sqlserverflexalpha_user" "ptlsdbuser" { resource "stackit_sqlserverflexalpha_user" "ptlsdbuser" {
project_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.project_id project_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.project_id
instance_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.id instance_id = stackitalpha_postgresflexalpha_instance.ptlsdbsrv.id

View file

@ -31,7 +31,7 @@ func ConfigureClient(
} else { } else {
apiClientConfigOptions = append(apiClientConfigOptions, config.WithRegion(providerData.GetRegion())) apiClientConfigOptions = append(apiClientConfigOptions, config.WithRegion(providerData.GetRegion()))
} }
apiClient, err := sqlserverflexalpha.NewAPIClient(apiClientConfigOptions...) apiClient, err := sqlserverflex.NewAPIClient(apiClientConfigOptions...)
if err != nil { if err != nil {
core.LogAndAddError( core.LogAndAddError(
ctx, ctx,