diff --git a/docs/resources/public_ip_associate.md b/docs/resources/public_ip_associate.md index 75311af4..829ea4af 100644 --- a/docs/resources/public_ip_associate.md +++ b/docs/resources/public_ip_associate.md @@ -4,7 +4,8 @@ page_title: "stackit_public_ip_associate Resource - stackit" subcategory: "" description: |- Associates an existing public IP to a network interface. This is useful for situations where you have a pre-allocated public IP or unable to use the stackit_public_ip resource to create a new public IP. Must have a region specified in the provider configuration. - !> The stackit_public_ip_associate resource should not be used together with the stackit_public_ip resource for the same network interface, as they both have control of the network interface association and this will lead to conflicts. + !> The stackit_public_ip_associate resource should not be used together with the stackit_public_ip resource for the same public IP or for the same network interface. + Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association. ~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources. --- @@ -12,7 +13,8 @@ description: |- Associates an existing public IP to a network interface. This is useful for situations where you have a pre-allocated public IP or unable to use the `stackit_public_ip` resource to create a new public IP. Must have a `region` specified in the provider configuration. -!> The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same network interface, as they both have control of the network interface association and this will lead to conflicts. +!> The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same public IP or for the same network interface. +Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association. ~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources. diff --git a/stackit/internal/services/iaas/publicipassociate/resource.go b/stackit/internal/services/iaas/publicipassociate/resource.go index 80b5db91..84d1872c 100644 --- a/stackit/internal/services/iaas/publicipassociate/resource.go +++ b/stackit/internal/services/iaas/publicipassociate/resource.go @@ -99,6 +99,9 @@ func (r *publicIpAssociateResource) Configure(ctx context.Context, req resource. return } + core.LogAndAddWarning(ctx, &resp.Diagnostics, "The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same public IP or for the same network interface.", + "Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.") + r.client = apiClient tflog.Info(ctx, "iaas client configured") } @@ -109,7 +112,8 @@ func (r *publicIpAssociateResource) Schema(_ context.Context, _ resource.SchemaR "main": "Associates an existing public IP to a network interface. " + "This is useful for situations where you have a pre-allocated public IP or unable to use the `stackit_public_ip` resource to create a new public IP. " + "Must have a `region` specified in the provider configuration.", - "warning_message": "The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same network interface, as they both have control of the network interface association and this will lead to conflicts.", + "warning_message": "The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same public IP or for the same network interface. \n" + + "Using both resources together for the same public IP or network interface WILL lead to conflicts, as they both have control of the public IP and network interface association.", } resp.Schema = schema.Schema{ MarkdownDescription: features.AddBetaDescription(fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["warning_message"])), @@ -185,9 +189,6 @@ func (r *publicIpAssociateResource) Create(ctx context.Context, req resource.Cre ctx = tflog.SetField(ctx, "public_ip_id", publicIpId) ctx = tflog.SetField(ctx, "network_interface_id", networkInterfaceId) - core.LogAndAddWarning(ctx, &resp.Diagnostics, "The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same network interface.", - "The `stackit_public_ip_associate` resource should not be used together with the `stackit_public_ip` resource for the same network interface, as they both have control of the network interface association and this will lead to conflicts.") - // Generate API request body from model payload, err := toCreatePayload(&model) if err != nil {