Add uri to user resources for MongoDB Flex and PostgreSQL Flex (#512)
* add uri to mongodb user resource * add uri to postgresflex user resource * update docs * extend warning about empty uri * extend warning about empty uri
This commit is contained in:
parent
a73706d82f
commit
043f1d6331
6 changed files with 28 additions and 4 deletions
|
|
@ -42,6 +42,7 @@ type Model struct {
|
|||
Password types.String `tfsdk:"password"`
|
||||
Host types.String `tfsdk:"host"`
|
||||
Port types.Int64 `tfsdk:"port"`
|
||||
Uri types.String `tfsdk:"uri"`
|
||||
}
|
||||
|
||||
// NewUserResource is a helper function to simplify the provider implementation.
|
||||
|
|
@ -179,6 +180,10 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
|
|||
"port": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -329,8 +334,8 @@ func (r *userResource) ImportState(ctx context.Context, req resource.ImportState
|
|||
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[1])...)
|
||||
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("user_id"), idParts[2])...)
|
||||
core.LogAndAddWarning(ctx, &resp.Diagnostics,
|
||||
"MongoDB Flex user imported with empty password",
|
||||
"The user password is not imported as it is only available upon creation of a new user. The password field will be empty.",
|
||||
"MongoDB Flex user imported with empty password and empty uri",
|
||||
"The user password and uri are not imported as they are only available upon creation of a new user. The password and uri fields will be empty.",
|
||||
)
|
||||
tflog.Info(ctx, "MongoDB Flex user state imported")
|
||||
}
|
||||
|
|
@ -380,6 +385,7 @@ func mapFieldsCreate(userResp *mongodbflex.CreateUserResponse, model *Model) err
|
|||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
model.Uri = types.StringPointerValue(user.Uri)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue