diff --git a/internal/provider/resource_globalaccount_trust_configuration.go b/internal/provider/resource_globalaccount_trust_configuration.go index c841ba36..0e6cd8c2 100644 --- a/internal/provider/resource_globalaccount_trust_configuration.go +++ b/internal/provider/resource_globalaccount_trust_configuration.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/SAP/terraform-provider-btp/internal/btpcli" @@ -75,6 +77,9 @@ __Further documentation:__ "id": schema.StringAttribute{ MarkdownDescription: "The origin of the identity provider.", Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "type": schema.StringAttribute{ MarkdownDescription: "The trust type.", diff --git a/internal/provider/resource_subaccount.go b/internal/provider/resource_subaccount.go index 697bf304..e3605632 100644 --- a/internal/provider/resource_subaccount.go +++ b/internal/provider/resource_subaccount.go @@ -244,17 +244,6 @@ func (rs *subaccountResource) Create(ctx context.Context, req resource.CreateReq args.Labels = labels } - // The BTP CLI and CIS use different parameters for the subaccount usage - // To trigger the right state we must distinguish how to set the value in CREATE scenarios - // Options: "" == ignored in CREATE request, "true" == boolean true in CREATE request, "false" == boolean false in CREATE request - /*if plan.Usage.IsUnknown() || plan.Usage.IsNull() { - // No usage explicitly requested - args.UsedForProduction = "" - } else { - // Explicit setting of usage requested - - } - */ args.UsedForProduction = mapUsageToUsedForProduction(plan.Usage.ValueString()) cliRes, _, err := rs.cli.Accounts.Subaccount.Create(ctx, &args) diff --git a/internal/provider/resource_subaccount_environment_instance.go b/internal/provider/resource_subaccount_environment_instance.go index 1e4271a2..cc30c0ed 100644 --- a/internal/provider/resource_subaccount_environment_instance.go +++ b/internal/provider/resource_subaccount_environment_instance.go @@ -10,6 +10,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" @@ -88,6 +90,9 @@ __Further documentation:__ "id": schema.StringAttribute{ MarkdownDescription: "The ID of the environment instance.", Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "broker_id": schema.StringAttribute{ MarkdownDescription: "The ID of the associated environment broker.", diff --git a/internal/provider/resource_subaccount_service_binding.go b/internal/provider/resource_subaccount_service_binding.go index cc30a95c..70a549ff 100644 --- a/internal/provider/resource_subaccount_service_binding.go +++ b/internal/provider/resource_subaccount_service_binding.go @@ -84,6 +84,9 @@ func (rs *subaccountServiceBindingResource) Schema(_ context.Context, _ resource "id": schema.StringAttribute{ MarkdownDescription: "The ID of the service binding.", Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "ready": schema.BoolAttribute{ MarkdownDescription: "Shows whether the service binding is ready.", diff --git a/internal/provider/resource_subaccount_subscription.go b/internal/provider/resource_subaccount_subscription.go index c110c893..aeacad66 100644 --- a/internal/provider/resource_subaccount_subscription.go +++ b/internal/provider/resource_subaccount_subscription.go @@ -150,6 +150,9 @@ You must be assigned to the subaccount admin role.`, "id": schema.StringAttribute{ MarkdownDescription: "The technical ID generated by XSUAA for a multitenant application when a consumer subscribes to the application.", Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "subscription_url": schema.StringAttribute{ MarkdownDescription: "The URL for app users to launch the subscribed application.", diff --git a/internal/provider/resource_subaccount_trust_configuration.go b/internal/provider/resource_subaccount_trust_configuration.go index c7f08bf7..06ba6672 100644 --- a/internal/provider/resource_subaccount_trust_configuration.go +++ b/internal/provider/resource_subaccount_trust_configuration.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/SAP/terraform-provider-btp/internal/btpcli" @@ -83,6 +85,9 @@ __Further documentation:__ "id": schema.StringAttribute{ MarkdownDescription: "The origin of the identity provider.", Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "type": schema.StringAttribute{ MarkdownDescription: "The trust type.",