terraform-provider-stackitp.../docs/resources/public_ip_associate.md
Ruben Hönle 53a3697850
feat(iaas): support for v2 API (#1070)
relates to STACKITTPR-313
2025-12-17 15:40:46 +01:00

2.5 KiB

page_title subcategory description
stackit_public_ip_associate Resource - stackit 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 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.

stackit_public_ip_associate (Resource)

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 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.

Example Usage

resource "stackit_public_ip_associate" "example" {
  project_id           = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  public_ip_id         = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  network_interface_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

# Only use the import statement, if you want to import an existing public ip associate
import {
  to = stackit_public_ip_associate.import-example
  id = "${var.project_id},${var.region},${var.public_ip_id},${var.network_interface_id}"
}

Schema

Required

  • network_interface_id (String) The ID of the network interface (or virtual IP) to which the public IP should be attached to.
  • project_id (String) STACKIT project ID to which the public IP is associated.
  • public_ip_id (String) The public IP ID.

Optional

  • region (String) The resource region. If not defined, the provider region is used.

Read-Only

  • id (String) Terraform's internal resource ID. It is structured as "project_id,region,public_ip_id,network_interface_id".
  • ip (String) The IP address.