feat: Allow move state on new Observability resources (#593)

* feat: Allow move state on new Observability resources

* Extend description to explain how to move a argus resource to observability

* Update argus docs with examples how to move a resource to observability

---------

Co-authored-by: Marcel Jacek <Marcel.Jacek@stackit.cloud>
This commit is contained in:
João Palet 2025-01-20 08:54:30 +00:00 committed by GitHub
parent fc805d8e1d
commit 1a66887c01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 438 additions and 15 deletions

View file

@ -373,16 +373,15 @@ func (r *instanceResource) Configure(ctx context.Context, req resource.Configure
tflog.Info(ctx, "Argus instance client configured")
}
// Schema defines the schema for the resource.
func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
var (
descriptions = map[string]string{
"main": "Argus instance resource schema. Must have a `region` specified in the provider configuration.",
"deprecation_message": "The `stackit_argus_instance` resource has been deprecated and will be removed after February 26th 2025. " +
"Please use `stackit_observability_instance` instead, which offers the exact same functionality.",
}
resp.Schema = schema.Schema{
Schema = schema.Schema{
Description: fmt.Sprintf("%s\n%s", descriptions["main"], descriptions["deprecation_message"]),
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["deprecation_message"]),
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s\n\n%s", descriptions["main"], descriptions["deprecation_message"], exampleMoveToObservability),
DeprecationMessage: descriptions["deprecation_message"],
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
@ -776,6 +775,11 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
},
},
}
)
// Schema defines the schema for the resource.
func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = Schema
}
// Create creates the resource and sets the initial Terraform state.