### Create a Load Balancer Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_loadbalancer_v2.md Example of creating a load balancer with a specified name, description, VIP subnet ID, and administrative state. ```terraform resource "nhncloud_lb_loadbalancer_v2" "tf_loadbalancer_01"{ name = "tf_loadbalancer_01" description = "create loadbalancer by terraform." vip_subnet_id = data.nhncloud_networking_vpcsubnet_v2.default_subnet.id vip_address = "192.168.0.10" admin_state_up = true } ``` -------------------------------- ### Get nhncloud_compute_keypair_v2 Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_compute_keypair_v2.md Example of how to retrieve information about a keypair using its name. ```terraform data "nhncloud_compute_keypair_v2" "my_keypair"{ name = "my_keypair" } ``` -------------------------------- ### Example Usage of nhncloud_networking_vpcsubnet_v2 Data Source Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_networking_vpcsubnet_v2.md Demonstrates how to use the nhncloud_networking_vpcsubnet_v2 data source to query for a specific subnet by its ID, name, and other attributes. ```terraform data "nhncloud_networking_vpcsubnet_v2" "default_subnet" { region = "KR1" tenant_id = "ba3be1254ab141bcaef674e74630a31f" id = "05f6fdc3-641f-48df-b986-773b6489654f" name = "Default Network" shared = true } ``` -------------------------------- ### Create u2 Instance Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_instance_v2.md Example of creating a u2 instance with specified image, flavor, network, and block device configurations. Ensure the image, flavor, and network data sources are correctly defined. ```terraform resource "nhncloud_compute_instance_v2" "tf_instance_01"{ name = "tf_instance_01" region = "KR1" key_pair = "terraform-keypair" image_id = data.nhncloud_images_image_v2.ubuntu_2004_20201222.id flavor_id = data.nhncloud_compute_flavor_v2.u2c2m4.id security_groups = ["default"] availability_zone = "kr-pub-a" network { name = data.nhncloud_networking_vpc_v2.default_network.name uuid = data.nhncloud_networking_vpc_v2.default_network.id } block_device { uuid = data.nhncloud_images_image_v2.ubuntu_2004_20201222.id source_type = "image" destination_type = "local" boot_index = 0 delete_on_termination = true volume_size = 30 } } ``` -------------------------------- ### Create a NHN Cloud Routing Table Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_routingtable_v2.md Example of creating a routing table associated with a VPC. Ensure the VPC resource is defined prior to this. ```terraform resource "nhncloud_networking_vpc_v2" "resource-vpc-01" { ... } resource "nhncloud_networking_routingtable_v2" "resource-rt-01" { name = "resource-rt-01" vpc_id = nhncloud_networking_vpc_v2.resource-vpc-01.id distributed = false } ``` -------------------------------- ### Create Instance with Network and Block Storage Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_instance_v2.md Example of creating an instance with a different flavor, multiple security groups, and specific network and block device configurations. This includes attaching a pre-existing port and adding a blank volume. ```terraform resource "nhncloud_compute_instance_v2" "tf_instance_02" { name = "tf_instance_02" region = "KR1" key_pair = "terraform-keypair" flavor_id = data.nhncloud_compute_flavor_v2.m2c1m2.id security_groups = ["default","web"] network { name = data.nhncloud_networking_vpc_v2.default_network.name uuid = data.nhncloud_networking_vpc_v2.default_network.id } network { port = nhncloud_networking_port_v2.port_1.id } block_device { uuid = data.nhncloud_images_image_v2.ubuntu_2004_20201222.id source_type = "image" destination_type = "volume" boot_index = 0 volume_size = 20 delete_on_termination = true } block_device { source_type = "blank" destination_type = "volume" boot_index = 1 volume_size = 20 delete_on_termination = true } } ``` -------------------------------- ### Create a VPC Subnet Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_vpcsubnet_v2.md Example of creating a VPC subnet with required parameters like name, VPC ID, CIDR, and routing table ID. ```terraform resource "nhncloud_networking_vpcsubnet_v2" "resource-vpcsubnet-01" { name = "tf-vpcsubnet-01" vpc_id = "def56b5e-0f1d-4a31-8005-4d716127f177" cidr = "10.10.10.0/24" routingtable_id = "c3ed678d-de8b-4bf7-abea-b7c1118f0828" } ``` -------------------------------- ### Attach Block Storage to Instance Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_volume_attach_v2.md This example demonstrates how to attach a block storage volume to a compute instance using the `nhncloud_compute_volume_attach_v2` resource. Ensure the instance and volume resources are defined prior to this. ```terraform # Create Instance resource "nhncloud_compute_instance_v2" "tf_instance_01" { ... } # Create Block Storage resource "nhncloud_blockstorage_volume_v2" "volume_01" { ... } # Attach Block Storage resource "nhncloud_compute_volume_attach_v2" "volume_to_instance"{ instance_id = nhncloud_compute_instance_v2.tf_instance_02.id volume_id = nhncloud_blockstorage_volume_v2.volume_01.id vendor_options { ignore_volume_confirmation = true } } ``` -------------------------------- ### Get Routing Table by ID Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_networking_routingtable_v2.md Example of how to fetch a routing table using its ID. ```terraform data "nhncloud_networking_routingtable_v2" "default_rt" { id = "bf15f6f6-1339-4057-a7fe-5811d39bab18" } ``` -------------------------------- ### Download and Install Terraform Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/attach-format-mount-volume/README.md Installs Terraform version 0.12.9 on Linux AMD64. Ensure Terraform is in your system's PATH. ```sh wget -P /tmp/ https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip unzip /tmp/terraform_0.12.9_linux_amd64.zip sudo mv terraform /usr/local/bin/ terraform --version ``` -------------------------------- ### Create a Floating IP Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_floatingip_v2.md Example of creating a Floating IP resource using the nhncloud provider. Requires specifying the IP pool from which to allocate the address. ```terraform resource "nhncloud_networking_floatingip_v2" "fip_01" { pool = "Public Network" } ``` -------------------------------- ### Import Keypair an Existing Public Key Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_keypair_v2.md This example demonstrates how to import an existing public SSH key into NHN Cloud using the `nhncloud_compute_keypair_v2` resource. The `name` argument is required to identify the keypair. ```APIDOC ## Resource: nhncloud_compute_keypair_v2 ### Description Manages a Compute Keypair resource within NHN Cloud. ### Example Usage: Import Keypair an Existing Public Key ```terraform resource "nhncloud_compute_keypair_v2" "tf_kp_01" { name = "tf_kp_01" } ``` ### Argument Reference * `region` - (Optional) The region name to which the keypair to query belongs. * `name` - (Required) A unique name for the keypair. Changing this creates a new keypair. * `public_key` - (Optional) A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever. ### Attributes Reference The following attributes are exported: * `region` - See Argument Reference above. * `name` - See Argument Reference above. * `public_key` - See Argument Reference above. * `fingerprint` - The fingerprint of the public key. * `private_key` - The generated private key when no public key is specified. ``` -------------------------------- ### Create Keypair Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_keypair_v2.md This example shows how to create a new SSH keypair in NHN Cloud. You can either provide a `public_key` or let the resource automatically generate a new public/private key pair. If a key pair is automatically generated, losing access to the resource means losing access to the keypair permanently. ```APIDOC ## Resource: nhncloud_compute_keypair_v2 ### Description Manages a Compute Keypair resource within NHN Cloud. ### Example Usage: Create Keypair ```terraform resource "nhncloud_compute_keypair_v2" "tf_kp_02" { name = "tf_kp_02" public_key = "ssh-rsa AAAA... Generated-by-Nova" } ``` ### Argument Reference * `region` - (Optional) The region name to which the keypair to query belongs. * `name` - (Required) A unique name for the keypair. Changing this creates a new keypair. * `public_key` - (Optional) A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever. ### Attributes Reference The following attributes are exported: * `region` - See Argument Reference above. * `name` - See Argument Reference above. * `public_key` - See Argument Reference above. * `fingerprint` - The fingerprint of the public key. * `private_key` - The generated private key when no public key is specified. ``` -------------------------------- ### Create an LB Monitor v2 Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_monitor_v2.md Example of creating a basic HTTP health monitor for a load balancer pool. Ensure the pool_id is correctly referenced from an existing nhncloud_lb_pool_v2 resource. ```terraform resource "nhncloud_lb_monitor_v2" "tf_monitor_01"{ name = "tf_monitor_01" pool_id = nhncloud_lb_pool_v2.tf_pool_01.id type = "HTTP" delay = 20 timeout = 10 max_retries = 5 url_path = "/" http_method = "GET" expected_codes = "200-202" admin_state_up = true health_check_port = 2000 } ``` -------------------------------- ### nhncloud_networking_port_v2 Resource Example Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_port_v2.md Example of how to declare an nhncloud_networking_port_v2 resource in Terraform. ```APIDOC ## Resource: nhncloud_networking_port_v2 ### Description Manages a Network Port (v2) resource within NHN Cloud. ### Argument Reference * `name` - (Required) The port name to create. * `description` - (Optional) The port description. * `network_id` - (Required) The ID of the VPC network to create a port. * `tenant_id` - (Optional) The tenant ID of the port to create. * `device_id` - (Optional) The device ID to which the created port will be connected. * `fixed_ip` - (Optional) Setting information of the fixed IP of a port to create
Must not include the `no_fixed_ip` attribute. * `fixed_ip.subent_id` - (Required) The Subnet ID of a fixed IP. * `fixed_ip.ip_address` - (Optional) The address of fixed IP to configure. * `no_fixed_ip` - (Optional) `true`: Port without fixed IP
Must not include the `fixed_ip` attribute. * `admin_state_up` - (Optional) Administrator control status
`true`: Running
`false`: Suspended. ### Attribute Reference The following attributes are exported: * `description` - See Argument Reference above. * `admin_state_up` - See Argument Reference above. * `tenant_id` - See Argument Reference above. * `device_id` - See Argument Reference above. * `fixed_ip` - See Argument Reference above. * `all_fixed_ips` - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API. ``` -------------------------------- ### Associate Floating IP to a Port Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_floatingip_associate_v2.md This example demonstrates how to create a network port, an instance, a floating IP, and then associate the floating IP with the created port. Ensure the port is attached to an instance's network. ```terraform # Create Network Port resource "nhncloud_networking_port_v2" "port_1" { ... } # Create Instance resource "nhncloud_compute_instance_v2" "tf_instance_01" { ... network { port = nhncloud_networking_port_v2.port_1.id } ... } # Create Floating IP resource "nhncloud_networking_floatingip_v2" "fip_01" { ... } # Associate Floating IP resource "nhncloud_networking_floatingip_associate_v2" "fip_associate" { floating_ip = nhncloud_networking_floatingip_v2.fip_01.address port_id = nhncloud_networking_port_v2.port_1.id } ``` -------------------------------- ### Querying an image by name, sorting, owner, and tag Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_images_image_v2.md This example demonstrates how to query for an image using its name, sort the results by creation date in ascending order, filter by a specific owner ID, and search for images with a particular tag. This is useful for finding older images or images with specific characteristics. ```terraform # Query the oldest image from images with the same name data "nhncloud_images_image_v2" "windows2016_20200218" { name = "Windows 2019 STD with MS-SQL 2019 Standard (2020.12.22) KO" sort_key = "created_at" sort_direction = "asc" owner = "c289b99209ca4e189095cdecebbd092d" tag = "_AVAILABLE_" } ``` -------------------------------- ### Example Usage of nhncloud_blockstorage_snapshot_v2 Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_blockstorage_snapshot_v2.md This snippet shows how to query for a specific block storage snapshot using its name, volume ID, and status. It also demonstrates how to select the most recently created snapshot. ```terraform data "nhncloud_blockstorage_snapshot_v2" "my_snapshot" { name = "my-snapshot" volume_id = data.nhncloud_blockstorage_volume_v2.volume_00.id status = "available" most_recent = true } ``` -------------------------------- ### Create an LB Pool Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_pool_v2.md Example of creating a load balancer pool with HTTP protocol, application cookie session persistence, and admin state enabled. Ensure the listener resource is defined. ```terraform resource "nhncloud_lb_pool_v2" "tf_pool_01"{ name = "tf_pool_01" description = "create pool by terraform." protocol = "HTTP" listener_id = nhncloud_lb_listener_v2.tf_listener_01.id lb_method = "LEAST_CONNECTIONS" persistence{ type = "APP_COOKIE" cookie_name = "testCookie" } admin_state_up = true } ``` -------------------------------- ### Clone NHN Cloud Terraform Provider Repository Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/README.md Clone the repository to start working with the NHN Cloud Terraform Provider. ```sh $ git clone git@github.com:nhn-cloud/terraform-provider-nhncloud.git ``` -------------------------------- ### Create nhncloud_lb_member_v2 Resource Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_member_v2.md Example of how to define an nhncloud_lb_member_v2 resource in Terraform. This snippet shows the required arguments like pool_id, subnet_id, address, and protocol_port, along with optional arguments like weight and admin_state_up. ```terraform resource "nhncloud_lb_member_v2" "tf_member_01"{ pool_id = nhncloud_lb_pool_v2.tf_pool_01.id subnet_id = data.nhncloud_networking_vpcsubnet_v2.default_subnet.id address = nhncloud_compute_instance_v2.tf_instance_01.access_ip_v4 protocol_port = 8080 weight = 4 admin_state_up = true } ``` -------------------------------- ### Create a Network Security Group Rule Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_secgroup_rule.md Example of creating an ingress rule for TCP port 22 for IPv4 traffic from any IP address, associated with a specific security group. ```terraform resource "nhncloud_networking_secgroup_rule_v2" "resource-sg-rule-01" { direction = "ingress" ethertype = "IPv4" protocol = "tcp" port_range_min = 22 port_range_max = 22 remote_ip_prefix = "0.0.0.0/0" security_group_id = data.nhncloud_networking_secgroup_v2.sg-01.id } ###################### Data Sources ###################### data "nhncloud_networking_secgroup_v2" "sg-01" { name = "sg-01" } ``` -------------------------------- ### Get nhncloud_compute_flavor_v2 by Name Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_compute_flavor_v2.md Use this data source to find a compute flavor by its name. The 'name' argument is optional; if omitted, it may return a default or error depending on the provider's implementation. ```terraform data "nhncloud_compute_flavor_v2" "u2c2m4"{ name = "u2.c2m4" } ``` -------------------------------- ### Get NHN Cloud VPC Network Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_networking_vpc_v2.md Use this data source to query details of a specific VPC network by its region, tenant ID, ID, or name. The 'id' attribute will be set to the found network's ID. ```terraform data "nhncloud_networking_vpc_v2" "default_network" { region = "KR1" tenant_id = "ba3be1254ab141bcaef674e74630a31f" id = "e34fc878-89f6-4d17-a039-3830a0b78346" name = "Default Network" } ``` -------------------------------- ### Initialize Terraform Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/index.md Run this command in the directory containing your Terraform configuration files to initialize Terraform and download the necessary provider plugins. ```bash $ terraform init ``` -------------------------------- ### Apply Terraform Deployment Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/multiple-vm-with-floating-ip/Readme.md Apply the Terraform plan to create the virtual machine instances and configure floating IPs. Use -auto-approve to skip confirmation. ```bash terraform apply -auto-approve # or with specific variables terraform apply -auto-approve \ -var 'pool=gateway' \ -var 'flavor=m02.c02.d20' \ -var 'instance_count=3' \ -var 'network_name=my-network' \ -var 'ssh_key_file=./id_rsa_os' ``` -------------------------------- ### Initialize Terraform Providers Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/attach-format-mount-volume/README.md Initializes the Terraform working directory and downloads necessary providers. ```sh terraform init ``` -------------------------------- ### Build NHN Cloud Terraform Provider (Development) Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/README.md Compile the provider during development. This command builds the provider and outputs the binary to the current directory. ```sh $ make build ``` -------------------------------- ### Build NHN Cloud Terraform Provider Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/README.md Build the provider plugin after cloning the repository. This command compiles the provider and places the binary in the current directory. ```sh $ cd terraform-provider-nhncloud $ make build ``` -------------------------------- ### Basic VPC Creation Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_vpc_v2.md Creates a basic VPC with a specified name and IPv4 CIDR block. Ensure the name and cidrv4 are unique within your project. ```terraform resource "nhncloud_networking_vpc_v2" "resource-vpc-01" { name = "tf-vpc-01" cidrv4 = "10.0.0.0/8" } ``` -------------------------------- ### Source OpenRC File Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/multiple-vm-with-floating-ip/Readme.md Source the OpenRC file into your shell environment to set up authentication credentials for OpenStack. ```bash source ./openrc ``` -------------------------------- ### Create an HTTP Listener Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_listener_v2.md This snippet demonstrates how to create an HTTP listener. Ensure the loadbalancer_id is correctly specified. ```terraform resource "nhncloud_lb_listener_v2" "tf_listener_http_01"{ name = "tf_listener_01" description = "create listener by terraform." protocol = "HTTP" protocol_port = 80 loadbalancer_id = nhncloud_lb_loadbalancer_v2.tf_loadbalancer_01.id default_pool_id = "" connection_limit = 2000 timeout_client_data = 5000 timeout_member_connect = 5000 timeout_member_data = 5000 timeout_tcp_inspect = 5000 admin_state_up = true } ``` -------------------------------- ### Import Keypair Using Existing Public Key Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_keypair_v2.md Use this snippet to import an existing public key into NHN Cloud Compute as a keypair. The private key will be automatically generated if not provided. ```terraform resource "nhncloud_compute_keypair_v2" "tf_kp_01" { name = "tf_kp_01" } ``` -------------------------------- ### nhncloud_lb_listener_v2 Resource Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_listener_v2.md This snippet shows how to configure an HTTP listener and a TERMINATED_HTTPS listener using the nhncloud_lb_listener_v2 resource. ```APIDOC ## Resource: nhncloud_lb_listener_v2 ### Description Manages an LB Listener V2 resource within NHN Cloud. ### Argument Reference * `name` - (Optional) The name of the listener to create. * `description` - (Optional) The description of the listener. * `protocol` - (Required) The protocol of the listener to create
One among `TCP`, `HTTP`, `HTTPS`, and `TERMINATED_HTTPS`. * `protocol_port` - (Required) The port of the listener to create. * `loadbalancer_id` - (Required) The ID of the load balancer to be connected with the listener to create. * `default_pool_id` - (Optional) The ID of the default pool to be connected with the listener to create. * `connection_limit` - (Optional) The maximum connection count allowed for the listener to create. * `timeout_client_data` - (Optional) The timeout setting when the client is inactive (ms). * `timeout_member_connect` - (Optional) The timeout setting when the member is connected (ms). * `timeout_member_data` - (Optional) The timeout setting when the member is inactive (ms). * `timeout_tcp_inspect` - (Optional) The timeout to wait for additional TCP packets for content inspection (ms). * `default_tls_container_ref` - (Optional) The path of TLC certificate to be used when the protocol is `TERMINATED_HTTPS`. * `sni_container_refs` - (Optional) The list of SNI certificate paths. * `insert_headers` - (Optional) The list of headers to be added before a request is sent to a backend member. * `admin_state_up` - (Optional) Administrator control status. * `keepalive_timeout` - (Optional) Keepalive timeout of listener. ### Attribute Reference The following attributes are exported: * `id` - The unique ID for the Listener. * `protocol` - See Argument Reference above. * `protocol_port` - See Argument Reference above. * `tenant_id` - See Argument Reference above. * `name` - See Argument Reference above. * `default_port_id` - See Argument Reference above. * `description` - See Argument Reference above. * `connection_limit` - See Argument Reference above. * `timeout_client_data` - See Argument Reference above. * `timeout_member_connect` - See Argument Reference above. * `timeout_member_data` - See Argument Reference above. * `timeout_tcp_inspect` - See Argument Reference above. * `default_tls_container_ref` - See Argument Reference above. * `sni_container_refs` - See Argument Reference above. * `admin_state_up` - See Argument Reference above. * `insert_headers` - See Argument Reference above. * `allowed_cidrs` - See Argument Reference above. * `keepalive_timeout` - See Argument Reference above. ### Example Usage ```terraform # HTTP Listener resource "nhncloud_lb_listener_v2" "tf_listener_http_01"{ name = "tf_listener_01" description = "create listener by terraform." protocol = "HTTP" protocol_port = 80 loadbalancer_id = nhncloud_lb_loadbalancer_v2.tf_loadbalancer_01.id default_pool_id = "" connection_limit = 2000 timeout_client_data = 5000 timeout_member_connect = 5000 timeout_member_data = 5000 timeout_tcp_inspect = 5000 admin_state_up = true } # Terminated HTTPS Listener resource "nhncloud_lb_listener_v2" "tf_listener_01"{ name = "tf_listener_01" description = "create listener by terraform." protocol = "TERMINATED_HTTPS" protocol_port = 443 loadbalancer_id = nhncloud_lb_loadbalancer_v2.tf_loadbalancer_01.id default_pool_id = "" connection_limit = 2000 timeout_client_data = 5000 timeout_member_connect = 5000 timeout_member_data = 5000 timeout_tcp_inspect = 5000 default_tls_container_ref = "https://kr1-api-key-manager-infrastructure.nhncloudservice.com/v1/containers/3258d456-06f4-48c5-8863-acf9facb26de" sni_container_refs = null admin_state_up = true } ``` ``` -------------------------------- ### Apply Terraform Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/app-with-networking/README.md Apply the Terraform configuration to deploy the OpenStack infrastructure. Use the -var flag to specify the desired floating IP pool, such as 'public'. ```bash terraform apply \ -var 'pool=public' ``` -------------------------------- ### Create a Network Port Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_port_v2.md This snippet demonstrates how to create a network port using the nhncloud_networking_port_v2 resource. It requires a name and the network ID, and allows specifying the admin state. ```terraform resource "nhncloud_networking_port_v2" "port_1" { name = "tf_port_1" network_id = data.nhncloud_networking_vpc_v2.default_network.id admin_state_up = "true" } ``` -------------------------------- ### Plan Terraform Deployment Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/multiple-vm-with-floating-ip/Readme.md Plan the Terraform deployment to review the changes that will be applied to your infrastructure. You can specify variables like instance count, network name, and flavor. ```bash terraform plan # or with specific variables terraform plan -var 'pool=gateway' \ -var 'flavor=m02.c02.d20' \ -var 'instance_count=3' \ -var 'network_name=my-network' \ -var 'ssh_key_file=./id_rsa_os' ``` -------------------------------- ### nhncloud_lb_monitor_v2 Resource Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_monitor_v2.md This snippet shows how to configure an `nhncloud_lb_monitor_v2` resource, defining health check parameters for a load balancer pool. ```APIDOC ## Resource: nhncloud_lb_monitor_v2 ### Description Manages a Load Balancer Monitor resource within NHN Cloud. This resource defines health check configurations for a specific load balancer pool. ### Argument Reference * `name` - (Optional) The name of the health monitor to create. * `pool_id` - (Required) The ID of the pool to be connected with the health monitor to create. * `type` - (Required) Support `TCP`, `HTTP`, and `HTTPS` only. * `delay` - (Required) Interval of status check. * `timeout` - (Required) Timeout for status check (seconds). Timeout must have a smaller value than delay. * `max_retries` - (Required) The number of maximum retries, between 1 and 10. * `url_path` - (Optional) The request URL for status check. * `http_method` - (Optional) The HTTP method to use for status check. The default is GET. * `expected_codes` - (Optional) HTTP(S) response code of members to be considered as normal status. `expected_codes` can be set as a list (`200,201,202`) or a range (`200-202`). * `admin_state_up` - (Optional) Administrator control status. * `host_header` - (Optional) The host header field value to use for status check. When the status check type is set with `TCP`, the value set in this field will be ignored. * `health_check_port` - (Optional) The member port to be health-checked. ### Attribute Reference The following attributes are exported: * `id` - The unique ID for the monitor. * `type` - See Argument Reference above. * `delay` - See Argument Reference above. * `timeout` - See Argument Reference above. * `max_retries` - See Argument Reference above. * `max_retries_down` - See Argument Reference above. * `url_path` - See Argument Reference above. * `http_method` - See Argument Reference above. * `expected_codes` - See Argument Reference above. * `admin_state_up` - See Argument Reference above. * `host_header` - See Argument Reference above. * `health_check_port` - See Argument Reference above. ### Example Usage ```terraform resource "nhncloud_lb_monitor_v2" "tf_monitor_01"{ name = "tf_monitor_01" pool_id = nhncloud_lb_pool_v2.tf_pool_01.id type = "HTTP" delay = 20 timeout = 10 max_retries = 5 url_path = "/" http_method = "GET" expected_codes = "200-202" admin_state_up = true health_check_port = 2000 } ``` ``` -------------------------------- ### Apply Terraform Execution Plan Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/attach-format-mount-volume/README.md Applies the Terraform execution plan to create or update resources. Use -auto-approve to skip confirmation. Supports specifying variables. ```sh terraform apply -auto-approve # or with specific variables terraform apply -auto-approve \ -var 'pool=gateway' \ -var 'flavor=m02.c02.d20' \ -var 'volume_size=3' \ -var 'network_name=my-network' \ -var 'ssh_key_file=./id_rsa_os' ``` -------------------------------- ### nhncloud_lb_member_v2 Resource Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_member_v2.md This snippet shows how to configure an nhncloud_lb_member_v2 resource, specifying the pool it belongs to, its subnet, IP address, protocol port, and optional weight and admin state. ```APIDOC ## Resource: nhncloud_lb_member_v2 ### Description Manages a load balancer member within NHN Cloud. ### Argument Reference * `pool_id` - (Required) The ID of the pool to which the member belongs. * `subnet_id` - (Required) The ID of the subnet for the member. * `address` - (Required) The IP address that will receive traffic from the load balancer. * `protocol_port` - (Required) The port on which the member will receive traffic. * `weight` - (Optional) The weight assigned to this member for traffic distribution. Higher weight means more traffic. * `admin_state_up` - (Optional) Controls the administrative state of the member (true for enabled, false for disabled). ### Attribute Reference * `id` - The unique identifier for the created member. * `weight` - The configured traffic weight for the member. * `admin_state_up` - The administrative state of the member. * `subnet_id` - The subnet ID associated with the member. * `pool_id` - The pool ID the member belongs to. * `address` - The IP address of the member. * `protocol_port` - The protocol port of the member. ``` -------------------------------- ### nhncloud_networking_vpc_v2 Resource Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_vpc_v2.md This snippet shows how to create a new VPC resource with a specified name and IPv4 CIDR block. Optional arguments for region and tenant ID can also be provided. ```APIDOC ## Resource: nhncloud_networking_vpc_v2 ### Description Manages a VPC resource within NHN Cloud. ### Argument Reference * `name` - (Required) The name for the VPC. * `cidrv4` - (Required) The IP range for the VPC. * `region` - (Optional) The region name of the VPC. * `tenant_id` - (Optional) The tenant ID of the VPC. ### Attribute Reference The following attributes are exported: * `region` - See Argument Reference above. * `name` - See Argument Reference above. * `shared` - Whether to share VPC. * `tenant_id` - See Argument Reference above. ### Example Usage ```terraform resource "nhncloud_networking_vpc_v2" "resource-vpc-01" { name = "tf-vpc-01" cidrv4 = "10.0.0.0/8" } ``` ``` -------------------------------- ### Generate Terraform Execution Plan Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/attach-format-mount-volume/README.md Generates an execution plan for Terraform, showing what actions will be taken. Supports specifying variables for customization. ```sh terraform plan # or with specific variables terraform plan -var 'pool=gateway' \ -var 'flavor=m02.c02.d20' \ -var 'volume_size=3' \ -var 'network_name=my-network' \ -var 'ssh_key_file=./id_rsa_os' ``` -------------------------------- ### Create SSD-type Empty Block Storage Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_blockstorage_volume_v2.md Use this snippet to create a general SSD type block storage volume. Specify the name, size, and availability zone. ```terraform resource "nhncloud_blockstorage_volume_v2" "volume_02" { name = "tf_volume_02" size = 10 availability_zone = "kr-pub-b" volume_type = "General SSD" } ``` -------------------------------- ### Create Keypair with Provided Public Key Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_compute_keypair_v2.md Use this snippet to create a new keypair in NHN Cloud Compute by providing an existing public key. If no public key is specified, a new pair will be generated. ```terraform resource "nhncloud_compute_keypair_v2" "tf_kp_02" { name = "tf_kp_02" public_key = "ssh-rsa AAAA... Generated-by-Nova" } ``` -------------------------------- ### Create a Terminated HTTPS Listener Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_listener_v2.md This snippet shows how to create a Terminated HTTPS listener. It requires a default_tls_container_ref for certificate management. ```terraform resource "nhncloud_lb_listener_v2" "tf_listener_01"{ name = "tf_listener_01" description = "create listener by terraform." protocol = "TERMINATED_HTTPS" protocol_port = 443 loadbalancer_id = nhncloud_lb_loadbalancer_v2.tf_loadbalancer_01.id default_pool_id = "" connection_limit = 2000 timeout_client_data = 5000 timeout_member_connect = 5000 timeout_member_data = 5000 timeout_tcp_inspect = 5000 default_tls_container_ref = "https://kr1-api-key-manager-infrastructure.nhncloudservice.com/v1/containers/3258d456-06f4-48c5-8863-acf9facb26de" sni_container_refs = null admin_state_up = true } ``` -------------------------------- ### Create HDD-type Empty Block Storage Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_blockstorage_volume_v2.md Use this snippet to create a general HDD type block storage volume. Specify the name, size, and availability zone. ```terraform resource "nhncloud_blockstorage_volume_v2" "volume_01" { name = "tf_volume_01" size = 10 availability_zone = "kr-pub-a" volume_type = "General HDD" } ``` -------------------------------- ### Source OpenStack Credentials Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/app-with-networking/README.md Source the OpenStack credentials file to set the required environment variables for the Terraform provider. This is a prerequisite for authenticating with your OpenStack cloud. ```bash source openrc ``` -------------------------------- ### Create Block Storage with Snapshot Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_blockstorage_volume_v2.md Use this snippet to create a block storage volume from an existing snapshot. The snapshot ID and desired size must be provided. ```terraform resource "nhncloud_blockstorage_volume_v2" "volume_03" { name = "tf_volume_03" description = "terraform create volume with snapshot test" snapshot_id = data.nhncloud_blockstorage_snapshot_v2.snapshot_01.id size = 30 } ``` -------------------------------- ### Source OpenStack RC File Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/attach-format-mount-volume/README.md Sources an OpenStack RC file to set environment variables for authentication. You will be prompted for your OpenStack password. ```sh source ~/Downloads/PROJECT-openrc.sh Please enter your OpenStack Password for project PROJECT as user username: ``` -------------------------------- ### Querying an image by name and most recent Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_images_image_v2.md Use this snippet to find a specific image by its name and select the most recently created one. Ensure the image name exactly matches the one displayed in the NHN Cloud console. ```terraform data "nhncloud_images_image_v2" "ubuntu_2004_20201222" { name = "Ubuntu Server 20.04.1 LTS (2020.12.22)" most_recent = true } ``` -------------------------------- ### List External Networks Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/app-with-networking/README.md List available external networks in OpenStack to identify usable floating IP pools. The 'ID' column provides the UUID required for the Terraform configuration. ```bash $ openstack network list --external +--------------------------------------+--------+----------------------------------------------------------------------------+ | ID | Name | Subnets | +--------------------------------------+--------+----------------------------------------------------------------------------+ | fd21df30-693b-496a-ac69-8637b9c24cd3 | public | a2d7c467-44f9-43c5-b387-8a6742f45b5c, ee51200c-9b64-4977-ad30-622039d7bba1 | +--------------------------------------+--------+----------------------------------------------------------------------------+ ``` -------------------------------- ### Configure NHN Cloud Provider Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/index.md This snippet shows the required Terraform configuration for the NHN Cloud provider, including version constraints and authentication details. Ensure you replace placeholder values with your actual NHN Cloud credentials. ```terraform # Define required providers terraform { required_version = ">= 1.0.0" required_providers { nhncloud = { source = "terraform.local/local/nhncloud" version = "1.0.1" } } } # Configure the nhncloud Provider provider "nhncloud" { user_name = "terraform-guide@nhncloud.com" tenant_id = "aaa4c0a12fd84edeb68965d320d17129" password = "difficultpassword" auth_url = "https://api-identity-infrastructure.nhncloud.com/v2.0" region = "KR1" } ``` -------------------------------- ### nhncloud_blockstorage_volume_v2 Data Source Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_blockstorage_volume_v2.md Queries for block storage volumes based on specified criteria. ```APIDOC ## Data Source: nhncloud_blockstorage_volume_v2 ### Description Use this data source to query for block storage volumes in NHN Cloud. ### Argument Reference * `region` - (Optional) The region name in which the block storage to query exists. * `name` - (Optional) The name of the block storage to query. * `status` - (Optional) The status of the block storage to query. * `metadata` - (Optional) The metadata related to the block storage to query. ### Attribute Reference `id` is set to the ID of the found volume. In addition, the following attributes are exported: * `region` - See Argument Reference above. * `name` - See Argument Reference above. * `status` - See Argument Reference above. * `metadata` - See Argument Reference above. * `volume_type` - The type of the volume. * `bootable` - Indicates if the volume is bootable. * `size` - The size of the volume in GB. ### Example Usage ``` data "nhncloud_blockstorage_volume_v2" "volume_00" { name = "ssd_volume1" status = "available" } ``` ``` -------------------------------- ### Attach an Internet Gateway to a Routing Table Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_routingtable_attach_gateway_v2.md Attaches a specified internet gateway to an existing routing table. Ensure the routing table and gateway IDs are valid. ```terraform resource "nhncloud_networking_routingtable_v2" "resource-rt-01" { ... } resource "nhncloud_networking_routingtable_attach_gateway_v2" "attach-gw-01" { routingtable_id = nhncloud_networking_routingtable_v2.resource-rt-01.id gateway_id = "5c7c578a-d199-4672-95d0-1980f996643f" } ``` -------------------------------- ### nhncloud_networking_routingtable_attach_gateway_v2 Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_routingtable_attach_gateway_v2.md Manages the attachment of an internet gateway to a routing table. ```APIDOC ## Resource: nhncloud_networking_routingtable_attach_gateway_v2 ### Description This resource attaches an internet gateway to a specified routing table. ### Argument Reference * `routingtable_id` - (Required) The routing table ID to modify. * `gateway_id` - (Required) The internet gateway ID to be associated with the routing table. ### Attribute Reference * `id` - The ID of the found attachment ID of the gateway and routingtable. * `routingtable_id` - The routing table ID. * `gateway_id` - The internet gateway ID. ``` -------------------------------- ### nhncloud_lb_pool_v2 Resource Configuration Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_lb_pool_v2.md This code snippet demonstrates how to configure the nhncloud_lb_pool_v2 resource in Terraform, specifying details like name, protocol, listener association, load balancing method, and session persistence. ```APIDOC ## Resource: nhncloud_lb_pool_v2 ### Description Manages a Load Balancer Pool (v2). ### Argument Reference * `name` - (Optional) Load balancer name. * `description` - (Optional) Pool description. * `protocol` - (Required) Protocol. One among `TCP`, `HTTP`, `HTTPS`, and `PROXY`. * `listener_id` - (Required) The ID of the listener with which a pool to create is associated. * `lb_method` - (Required) The load balancing method to distribute pool traffic to members. One among `ROUND_ROBIN`, `LEAST_CONNECTIONS`, and `SOURCE_IP`. * `persistence` - (Optional) Session persistence of the pool to create. * `persistence.type` - (Required) Session persistence type. One among `SOURCE_IP`, `HTTP_COOKIE`, and `APP_COOKIE`. Unavailable if the load balancing method is `SOURCE_IP`. HTTP_COOKIE and APP_COOKIE are unavailable if the protocol is `HTTPS` or `TCP`. * `persistence.cookie_name` - (Optional) The name of cookie. Available only when the session persistence type is `APP_COOKIE`. * `admin_state_up` - (Optional) Administrator control status. * `member_port` - (Optional) Member's receiving port. Traffic is sent to the port. Default is `-1`. ### Attribute Reference The following attributes are exported: * `id` - The unique ID for the pool. * `tenant_id` - See Argument Reference above. * `name` - See Argument Reference above. * `description` - See Argument Reference above. * `protocol` - See Argument Reference above. * `lb_method` - See Argument Reference above. * `persistence` - See Argument Reference above. * `admin_state_up` - See Argument Reference above. * `member_port` - See Argument Reference above. * `healthmonitor_id` - The health monitor ID of the pool. * `operating_status` - The operating status of the member. ### Example Usage ```terraform resource "nhncloud_lb_pool_v2" "tf_pool_01"{ name = "tf_pool_01" description = "create pool by terraform." protocol = "HTTP" listener_id = nhncloud_lb_listener_v2.tf_listener_01.id lb_method = "LEAST_CONNECTIONS" persistence{ type = "APP_COOKIE" cookie_name = "testCookie" } admin_state_up = true } ``` ``` -------------------------------- ### Query Block Storage Volume by Name and Status Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/data-sources/nhncloud_blockstorage_volume_v2.md Use this data source to find a block storage volume by its name and status. Ensure the volume exists in the specified region. ```terraform data "nhncloud_blockstorage_volume_v2" "volume_00" { name = "ssd_volume1" status = "available" } ``` -------------------------------- ### Destroy Terraform Deployment Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/examples/multiple-vm-with-floating-ip/Readme.md Destroy the deployed infrastructure, including all virtual machine instances and associated resources. Use -force to bypass confirmation prompts. ```bash terraform destroy -force # or with specific variables terraform destroy -force \ -var 'pool=gateway' \ -var 'flavor=m02.c02.d20' \ -var 'instance_count=3' \ -var 'network_name=my-network' \ -var 'ssh_key_file=./id_rsa_os' ``` -------------------------------- ### Basic Security Group Creation Source: https://github.com/nhn-cloud/terraform-provider-nhncloud/blob/master/docs/resources/nhncloud_networking_secgroup_v2.md Creates a basic security group with a specified name. The region is optional and defaults to the provider's configured region. ```terraform resource "nhncloud_networking_secgroup_v2" "resource-sg-01" { name = "sg-01" } ```