fix: fix wrong order of params
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
This commit is contained in:
parent
a42b1d6b31
commit
8dae6333cb
15 changed files with 8 additions and 25 deletions
|
|
@ -73,7 +73,6 @@ func (r *databaseDataSource) Configure(
|
|||
|
||||
// Schema defines the schema for the data source.
|
||||
func (r *databaseDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
|
||||
s := postgresflexalpha2.DatabaseDataSourceSchema(ctx)
|
||||
s.Attributes["id"] = schema.StringAttribute{
|
||||
Description: "Terraform's internal resource ID. It is structured as \\\"`project_id`,`region`,`instance_id`," +
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ func (r *databaseResource) Create(
|
|||
return
|
||||
}
|
||||
|
||||
database, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, region, instanceId, databaseId).
|
||||
database, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, instanceId, region, databaseId).
|
||||
SetTimeout(15 * time.Minute).
|
||||
SetSleepBeforeWait(15 * time.Second).
|
||||
WaitWithContext(ctx)
|
||||
|
|
@ -305,7 +305,7 @@ func (r *databaseResource) Read(
|
|||
ctx = tflog.SetField(ctx, "region", region)
|
||||
ctx = tflog.SetField(ctx, "database_id", databaseId)
|
||||
|
||||
databaseResp, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, region, instanceId, databaseId).
|
||||
databaseResp, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, instanceId, region, databaseId).
|
||||
SetTimeout(15 * time.Minute).
|
||||
SetSleepBeforeWait(15 * time.Second).
|
||||
WaitWithContext(ctx)
|
||||
|
|
@ -437,7 +437,7 @@ func (r *databaseResource) Update(
|
|||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
databaseResp, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, region, instanceId, databaseId64).
|
||||
databaseResp, err := postgresflexalpha3.GetDatabaseByIdWaitHandler(ctx, r.client, projectId, instanceId, region, databaseId64).
|
||||
SetTimeout(15 * time.Minute).
|
||||
SetSleepBeforeWait(15 * time.Second).
|
||||
WaitWithContext(ctx)
|
||||
|
|
@ -540,11 +540,9 @@ func (r *databaseResource) ImportState(
|
|||
req resource.ImportStateRequest,
|
||||
resp *resource.ImportStateResponse,
|
||||
) {
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
if req.ID != "" {
|
||||
|
||||
idParts := strings.Split(req.ID, core.Separator)
|
||||
|
||||
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
},
|
||||
testRegion,
|
||||
dataSourceModel{
|
||||
|
||||
UserModel: data.UserModel{
|
||||
Id: types.Int64Value(1),
|
||||
UserId: types.Int64Value(1),
|
||||
|
|
|
|||
|
|
@ -586,11 +586,9 @@ func (r *userResource) ImportState(
|
|||
req resource.ImportStateRequest,
|
||||
resp *resource.ImportStateResponse,
|
||||
) {
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
if req.ID != "" {
|
||||
|
||||
idParts := strings.Split(req.ID, core.Separator)
|
||||
|
||||
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
|
||||
|
|
@ -651,7 +649,6 @@ func (r *userResource) extractIdentityData(
|
|||
model resourceModel,
|
||||
identity UserResourceIdentityModel,
|
||||
) (*clientArg, error) {
|
||||
|
||||
var projectId, region, instanceId string
|
||||
var userId int64
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ func (d *databaseDataSource) Configure(
|
|||
|
||||
// Read retrieves the resource's state from the API.
|
||||
func (d *databaseDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||
|
||||
var model dataSourceModel
|
||||
diags := req.Config.Get(ctx, &model)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
|
|
|
|||
|
|
@ -422,11 +422,9 @@ func (r *databaseResource) ImportState(
|
|||
req resource.ImportStateRequest,
|
||||
resp *resource.ImportStateResponse,
|
||||
) {
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
if req.ID != "" {
|
||||
|
||||
idParts := strings.Split(req.ID, core.Separator)
|
||||
|
||||
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ func handleEncryption(
|
|||
resp.Encryption.KekKeyRingId == nil ||
|
||||
resp.Encryption.KekKeyVersion == nil ||
|
||||
resp.Encryption.ServiceAccount == nil {
|
||||
|
||||
if encryptionValue.IsNull() || encryptionValue.IsUnknown() {
|
||||
return sqlserverflexResGen.NewEncryptionValueNull()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ var modifiersFileByte []byte
|
|||
|
||||
// Schema defines the schema for the resource.
|
||||
func (r *instanceResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
|
||||
schema := sqlserverflexalpha2.InstanceResourceSchema(ctx)
|
||||
|
||||
fields, err := utils.ReadModifiersConfig(modifiersFileByte)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&sqlserverflexalpha.GetUserResponse{
|
||||
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
"role_2",
|
||||
|
|
|
|||
|
|
@ -389,11 +389,9 @@ func (r *userResource) ImportState(
|
|||
req resource.ImportStateRequest,
|
||||
resp *resource.ImportStateResponse,
|
||||
) {
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
if req.ID != "" {
|
||||
|
||||
idParts := strings.Split(req.ID, core.Separator)
|
||||
|
||||
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ func (r *databaseResource) Metadata(
|
|||
var modifiersFileByte []byte
|
||||
|
||||
func (r *databaseResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
|
||||
s := sqlserverflexbetaResGen.DatabaseResourceSchema(ctx)
|
||||
|
||||
fields, err := utils.ReadModifiersConfig(modifiersFileByte)
|
||||
|
|
|
|||
|
|
@ -139,7 +139,6 @@ func handleEncryption(
|
|||
resp.Encryption.KekKeyRingId == nil ||
|
||||
resp.Encryption.KekKeyVersion == nil ||
|
||||
resp.Encryption.ServiceAccount == nil {
|
||||
|
||||
if m.Encryption.IsNull() || m.Encryption.IsUnknown() {
|
||||
return sqlserverflexbetaResGen.NewEncryptionValueNull()
|
||||
}
|
||||
|
|
@ -172,7 +171,6 @@ func handleDSEncryption(
|
|||
resp.Encryption.KekKeyRingId == nil ||
|
||||
resp.Encryption.KekKeyVersion == nil ||
|
||||
resp.Encryption.ServiceAccount == nil {
|
||||
|
||||
if m.Encryption.IsNull() || m.Encryption.IsUnknown() {
|
||||
return sqlserverflexbetaDataGen.NewEncryptionValueNull()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&sqlserverflexbeta.GetUserResponse{
|
||||
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
"role_2",
|
||||
|
|
|
|||
|
|
@ -453,11 +453,9 @@ func (r *userResource) ImportState(
|
|||
req resource.ImportStateRequest,
|
||||
resp *resource.ImportStateResponse,
|
||||
) {
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
if req.ID != "" {
|
||||
|
||||
idParts := strings.Split(req.ID, core.Separator)
|
||||
|
||||
if len(idParts) != 4 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" || idParts[3] == "" {
|
||||
|
|
|
|||
|
|
@ -272,8 +272,12 @@ func GetDatabaseByIdWaitHandler(
|
|||
}
|
||||
switch oapiErr.StatusCode {
|
||||
case http.StatusBadGateway, http.StatusGatewayTimeout, http.StatusServiceUnavailable:
|
||||
tflog.Warn(ctx, "api responded with 50[2,3,4] status", map[string]interface{}{
|
||||
"status": oapiErr.StatusCode,
|
||||
})
|
||||
return false, nil, nil
|
||||
case http.StatusNotFound:
|
||||
tflog.Warn(ctx, "api responded with status", map[string]interface{}{
|
||||
tflog.Warn(ctx, "api responded with 404 status", map[string]interface{}{
|
||||
"status": oapiErr.StatusCode,
|
||||
})
|
||||
return false, nil, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue