### Example Usage Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/data-sources/monitoring_suite_metric_storage.md Use this data source to get information about an existing Monitoring Suite Metric Storage by its name or ID. ```terraform data "sakura_monitoring_suite_metric_storage" "foobar" { name = "foobar" # or # id = "metric-storage-resource-id" } ``` -------------------------------- ### Example Usage of sakura_apprun_dedicated_lb_nodes Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/data-sources/apprun_dedicated_lb_nodes.md This example demonstrates how to use the sakura_apprun_dedicated_lb_nodes data source to retrieve information about load balancer nodes. It first fetches details for the cluster, auto scaling group, and the load balancer itself, then uses these to query the load balancer nodes. ```terraform data "sakura_apprun_dedicated_cluster" "main" { name = "ExampleCluster" } data "sakura_apprun_dedicated_auto_scaling_group" "main" { cluster_id = data.sakura_apprun_dedicated_cluster.main.id id = "A5F8D577-7395-4EB4-83D9-AC60A1EF2C5B" } data "sakura_apprun_dedicated_lb" "main" { cluster_id = data.sakura_apprun_dedicated_cluster.main.id auto_scaling_group_id = data.sakura_apprun_dedicated_auto_scaling_group.main.id name = "ExampleLB" } data "sakura_apprun_dedicated_lb_nodes" "main" { cluster_id = data.sakura_apprun_dedicated_cluster.main.id auto_scaling_group_id = data.sakura_apprun_dedicated_auto_scaling_group.main.id lb_id = data.sakura_apprun_dedicated_lb.main.id } ``` -------------------------------- ### Basic sakura_apprun_dedicated_version Resource Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/apprun_dedicated_version.md This example shows how to create a basic AppRun dedicated version with manual scaling. It requires an existing dedicated cluster and application to be defined. ```terraform data "sakura_apprun_dedicated_cluster" "main" { name = "ExampleCluster" } data "sakura_apprun_dedicated_application" "main" { id = "A5F8D577-7395-4EB4-83D9-AC60A1EF2C5B" cluster_id = data.sakura_apprun_dedicated_cluster.main.id } resource "sakura_apprun_dedicated_version" "main" { application_id = data.sakura_apprun_dedicated_application.main.id cpu = 1000 memory = 512 image = "nginx:latest" cmd = ["/bin/sh"] scaling_mode = "manual" fixed_scale = 1 } ``` -------------------------------- ### sakura_apprun_shared Resource Example Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/apprun_shared.md This example demonstrates how to configure a SakuraCloud AppRun Shared application with a single component, defining its container registry, environment variables, health probes, and traffic settings. It also includes packet filtering configuration. ```terraform resource "sakura_apprun_shared" "foobar" { name = "foobar" timeout_seconds = 60 port = 8080 min_scale = 0 max_scale = 1 components =[{ name = "foobar" max_cpu = "0.1" max_memory = "256Mi" deploy_source = { container_registry = { image = "foobar.sakuracr.jp/my-app:latest" // or dockerhub / ghcr.io server = "foobar.sakuracr.jp" username = "username" password_wo = "userpassword" password_wo_version = 1 // for backward compatibility //password = "userpassword" } } env = [{ key = "key" value = "value" }] probe = { http_get = { path = "/" port = 8080 headers = [{ name = "name" value = "value" }, { name = "name2" value = "value2" }] } } }] traffics = [{ version_index = 0 percent = 100 }] packet_filter = { enabled = true settings = [{ from_ip = "192.0.2.0" from_ip_prefix_length = "24" }] } } ``` -------------------------------- ### AppRun Dedicated Auto Scaling Group Example Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/apprun_dedicated_auto_scaling_group.md This example demonstrates how to configure a sakura_apprun_dedicated_auto_scaling_group resource. It includes setting up cluster ID, name, zone, worker service class, name servers, and network interfaces with IP pools. Ensure all data sources like sakura_zone, sakura_internet, and sakura_apprun_dedicated_cluster are properly defined. ```terraform locals { sakura_dns = [ "133.242.0.3", "133.242.0.4" ] } data "sakura_zone" "is1c" { name = "is1c" } data "sakura_internet" "main" { name = "ExampleInternet" } data "sakura_apprun_dedicated_cluster" "main" { name = "ExampleCluster" } data "sakura_apprun_dedicated_worker_service_classes" "main" {} resource "sakura_apprun_dedicated_auto_scaling_group" "main" { cluster_id = sakura_apprun_dedicated_cluster.main.id name = "ExampleASG" zone = data.sakura_zone.is1c.name worker_service_class_path = data.sakura_apprun_dedicated_worker_service_classes.main.classes[0].path name_servers = local.sakura_dns min_nodes = 1 max_nodes = 3 interfaces = [{ interface_index = 0 upstream = data.sakura_internet.main.vswitch_id connects_to_lb = false netmask = data.sakura_internet.main.netmask default_gateway = data.sakura_internet.main.gateway ip_pool = [{ start = data.sakura_internet.main.min_ip_address end = data.sakura_internet.main.max_ip_address }] }] } ``` -------------------------------- ### Example Usage of sakura_bridge Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/bridge.md This snippet shows how to create a sakura_bridge resource and associate two sakura_vswitch resources with it. Ensure the bridge ID is correctly referenced. ```terraform resource "sakura_vswitch" "is1a" { name = "is1a" description = "description" bridge_id = sakura_bridge.foobar.id zone = "is1a" } resource "sakura_vswitch" "is1b" { name = "is1b" description = "description" bridge_id = sakura_bridge.foobar.id zone = "is1b" } resource "sakura_bridge" "foobar" { name = "foobar" description = "description" } ``` -------------------------------- ### Example Usage of sakura_eventbus_process_configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/eventbus_process_configuration.md This snippet demonstrates how to configure a sakura_eventbus_process_configuration resource. It shows different destination types like 'simplenotification', 'simplemq', and 'autoscale', along with their respective parameters and authentication methods. Note the use of write-only arguments for sensitive credentials. ```terraform resource "sakura_eventbus_process_configuration" "foobar" { name = "foobar" description = "description" tags = ["tag1"] destination = "simplenotification" parameters = "{\"group_id\": \"123456789012\", \"message\":\"test message\"}" sakura_access_token_wo = "test-token" sakura_access_token_secret_wo = "test-token-secret" credentials_wo_version = 1 # or # destination = "simplemq" # parameters = "{\"queue_name\": \"test-queue\", \"content\":\"TestContent\"}" # simplemq_api_key_wo = "test-apikey" # # or # destination = "autoscale" # parameters = "{\"action\": \"scale_up\", \"resource_id\":\"000000000000\"}" # sakura_access_token_wo = "test-token" # sakura_access_token_secret_wo = "test-token-secret" } ``` -------------------------------- ### Basic Enhanced Load Balancer Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md This example demonstrates a basic configuration for an Enhanced Load Balancer, including name, plan, failover settings, and essential components like health checks, sorry server, and bind port. ```terraform resource "sakura_enhanced_lb" "foobar" { name = "foobar" plan = 100 vip_failover = true gzip = true timeout = 10 region = "is1" # sticky_session = true # proxy_protocol = true health_check = { protocol = "http" delay_loop = 10 host_header = "example.com" path = "/" } sorry_server = { ip_address = "192.0.2.1" port = 80 } syslog = { server = "192.0.2.1" port = 514 } origin_guard = { token = "exampletoken" } strict_rule = { enabled = true } bind_port = [{ proxy_mode = "http" port = 80 response_header = [{ header = "Cache-Control" value = "public, max-age=10" }] }] server = [{ ip_address = sakura_server.foobar.ip_address port = 80 group = "group1" }] rule = [{ action = "forward" host = "www.example.com" source_ips = "192.2.0.1,192.12.0.2" path = "/" group = "group1" }, { action = "redirect" host = "www2.example.com" path = "/" group = "group1" redirect_location = "https://redirect.example.com" redirect_status_code = "301" }, { action = "fixed" host = "www3.example.com" path = "/" group = "group1" fixed_status_code = "200" fixed_content_type = "text/plain" fixed_message_body = "body" }] monitoring_suite = { enabled = true } description = "description" tags = ["tag1", "tag2"] } resource "sakura_server" "foobar" { name = "foobar" network_interface = [{ upstream = "shared" }] } ``` -------------------------------- ### Example Usage of sakura_nosql Data Source Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/data-sources/nosql.md Use this data source to retrieve information about an existing NoSQL database by its name or ID. Ensure you have the correct name or ID for the database you want to query. ```terraform data "sakura_nosql" "foobar" { name = "foobar" # or # id = "nosql-resource-id" } ``` -------------------------------- ### Server Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Defines the configuration for a destination server in the load balancing setup. This includes IP address, port, and optional settings for enabling the server, assigning it to a group, and enabling TLS. ```APIDOC ## Nested Schema for `server` ### Description Configuration for a destination server in the load balancing setup. ### Parameters #### Required Parameters - **ip_address** (String) - Required - The IP address of the destination server. - **port** (Number) - Required - The port number of the destination server. This must be in the range [`1`-`65535`]. #### Optional Parameters - **enabled** (Boolean) - Optional - The flag to enable as destination of load balancing. - **group** (String) - Optional - The name of load balancing group. This is used when using rule-based load balancing. The length of this value must be in the range [`1`-`10`]. - **tls_enabled** (Boolean) - Optional - The flag to enable TLS/SSL for communication with the destination server. ``` -------------------------------- ### Example Usage of sakura_local_router Data Source Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/data-sources/local_router.md Use this data source to fetch details of an existing Local Router by its name. This is useful for referencing the router's configuration in other Terraform resources. ```terraform data "sakura_local_router" "foobar" { name = "foobar" } ``` -------------------------------- ### Example Usage of sakura_workflows Data Source Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/data-sources/workflows.md This snippet demonstrates how to use the sakura_workflows data source to fetch details of a specific workflow. It first retrieves a subscription ID and then uses it to query the workflow by its ID. ```terraform data "sakura_workflows_subscription" "foobar" {} data "sakura_workflows" "foobar" { subscription_id = data.sakura_workflows_subscription.foobar.id id = "workflow-id" } ``` -------------------------------- ### AutoScale Threshold Scaling Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Demonstrates the change in threshold scaling configurations (cpu, router, schedule) for auto_scale, moving from Block syntax in v2 to Attribute or List of Attributes in v3. ```hcl cpu_threshold_scaling { // ... } router_threshold_scaling { // ... } schedule_scaling { // ... } schedule_scaling { // ... } ``` ```hcl cpu_threshold_scaling = { // ... } router_threshold_scaling = { // ... } schedule_scaling = [{ // ... }, { // ... }] ``` -------------------------------- ### Attribute vs. Block Syntax for User Field Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Demonstrates the recommended Attribute syntax for user fields in v3, contrasting it with the deprecated Block syntax from v2. ```hcl # Attribute構文。リストやブロックでもこちらで書くのを推奨されている user = [ { //... }, { //... } ] # Block構文。こちらは古い書き方で、現状Block機能を使うことで互換性のために実装できるが非推奨 user { // ... } user { // ... } ``` -------------------------------- ### Timeout Configuration Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Illustrates the syntax change for timeout settings, moving from a 'timeouts' block in v2 to an attribute in v3. ```hcl timeouts { create = "20m" } ``` ```hcl timeouts = { create = "20m" } ``` -------------------------------- ### Appliance Shared Components Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Details the migration of the 'components' field for apprun_shared from Block syntax in v2 to a List of Attributes in v3, including nested structures like deploy_source, env, and probe. ```hcl components { name = "foobar" // ... deploy_source { container_registry { image = "foorbar.sakuracr.jp/foorbar:latest" // ... } } env { key = "key" value = "value" } probe { http_get { path = "/" // ... headers { name = "name" value = "value" } } } } ``` ```hcl components = [{ name = "foobar" // ... deploy_source = { container_registry = { image = "foobar.sakuracr.jp/my-app:latest" // ... } } env = [{ key = "key" value = "value" }] probe = { http_get = { path = "/" // ... headers = [{ name = "name" value = "value" }] } } }] ``` -------------------------------- ### Origin Guard Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Configures origin guard to protect backend servers. ```APIDOC ## Schema for `origin_guard` ### Description Configuration for the origin guard feature. ### Parameters #### Required - **token** (String) - The token used for origin guard. Must be between 8 and 32 alphanumeric characters. ``` -------------------------------- ### Server Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Defines the configuration for backend servers. ```APIDOC ## Schema for `server` ### Description Configuration for backend servers in the load balancing pool. ``` -------------------------------- ### Let's Encrypt Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Configures Let's Encrypt settings for TLS certificates, including common name, subject alternative names, and terms of service acceptance. ```APIDOC ## Nested Schema for `letsencrypt` ### Description Configuration for Let's Encrypt TLS certificates. ### Parameters #### Read-Only Parameters - **common_name** (String) - Read-Only - The common name of the certificate. - **enabled** (Boolean) - Read-Only - The flag to accept the current Let's Encrypt terms of service(see: https://letsencrypt.org/repository/). This must be set `true` explicitly. - **subject_alt_names** (Set of String) - Read-Only - The subject alternative names of the certificate. ``` -------------------------------- ### Monitoring Suite Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Enables integration with a monitoring suite for enhanced observability. ```APIDOC ## Schema for `monitoring_suite` ### Description Configuration to enable signals to the Monitoring Suite. ### Parameters #### Optional - **enabled** (Boolean) - Enable sending signals to Monitoring Suite. ``` -------------------------------- ### CDROM Resource Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Shows the removal of 'content' and 'content_file_name' fields in v3 for the 'sakuracloud_cdrom' resource, requiring pre-creation of ISO images. ```hcl resource "sakuracloud_cdrom" "foobar" { name = "foobar" size = 5 content = "Hello, World!" content_file_name = "hello.txt" } ``` ```hcl # ローカルで事前にISOを作る (例: genisoimage / mkisofs / hdiutil 等) # echo "Hello, World!" > hello.txt ``` -------------------------------- ### Premium VPN Router with Advanced Network Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/vpn_router.md This snippet demonstrates a premium VPN router configuration with public and private network interfaces, DHCP server, static mappings, DNS forwarding, firewall rules, L2TP, port forwarding, PPTP, WireGuard, site-to-site VPN, static NAT, static routes, user management, scheduled maintenance, and monitoring. ```terraform resource "sakura_vpn_router" "premium" { name = "premium" description = "description" tags = ["tag1", "tag2"] plan = "premium" internet_connection = true public_network_interface = { vswitch_id = sakura_internet.foobar.vswitch_id vip = sakura_internet.foobar.ip_addresses[0] ip_addresses = [sakura_internet.foobar.ip_addresses[1], sakura_internet.foobar.ip_addresses[2]] aliases = [sakura_internet.foobar.ip_addresses[3]] vrid = 1 } private_network_interface = [{ index = 1 vswitch_id = sakura_vswitch.foobar.id vip = "192.168.11.1" ip_addresses = ["192.168.11.2", "192.168.11.3"] netmask = 24 }] dhcp_server = [{ interface_index = 1 range_start = "192.168.11.11" range_stop = "192.168.11.20" dns_servers = ["8.8.8.8", "8.8.4.4"] }] dhcp_static_mapping = [{ ip_address = "192.168.11.10" mac_address = "aa:bb:cc:aa:bb:cc" }] dns_forwarding = { interface_index = 1 dns_servers = ["133.242.0.3", "133.242.0.4"] } firewall = [{ interface_index = 1 direction = "send" expression = [{ protocol = "tcp" source_network = "" source_port = "80" destination_network = "" destination_port = "" allow = true logging = true description = "desc" }, { protocol = "ip" source_network = "" source_port = "" destination_network = "" destination_port = "" allow = false logging = true description = "desc" }] }] l2tp = { pre_shared_secret = "example" range_start = "192.168.11.21" range_stop = "192.168.11.30" } port_forwarding = [{ protocol = "udp" public_port = 10022 private_ip = "192.168.11.11" private_port = 22 description = "desc" }] pptp = { range_start = "192.168.11.31" range_stop = "192.168.11.40" } wire_guard = { ip_address = "192.168.31.1/24" peer = [{ name = "example" ip_address = "192.168.31.11" public_key = "" }] } site_to_site_vpn = [{ peer = "10.0.0.1" remote_id = "10.0.0.1" pre_shared_secret = "example" routes = ["10.0.0.0/8"] local_prefix = ["192.168.21.0/24"] }] site_to_site_vpn_parameter = { ike = { lifetime = 28800 dpd = { interval = 15 timeout = 30 } } esp = { lifetime = 1800 } encryption_algo = "aes256" hash_algo = "sha256" } static_nat = [{ public_ip = sakura_internet.foobar.ip_addresses[3] private_ip = "192.168.11.12" description = "desc" }] static_route = [{ prefix = "172.16.0.0/16" next_hop = "192.168.11.99" }] user = [{ name = "username" password_wo = "password" password_wo_version = 1 // for backward compatibility //password = "password" }] scheduled_maintenance = { day_of_week = "tue" hour = 1 } monitoring_suite = { enabled = true } } resource "sakura_internet" "foobar" { name = "foobar" } resource "sakura_vswitch" "foobar" { name = "foobar" } ``` -------------------------------- ### Data Source Filter Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Illustrates the change in filtering data sources from a dedicated 'filter' block in v2 to direct field matching in v3. ```hcl data "sakuracloud_xxx" "foobar" { filter { id = "xxxxxxxxxxxx" names = ["foobar"] tags = ["foo", "bar"] } } ``` ```hcl data "sakura_xxx" "foobar" { id = "xxxxxxxxxxxx" name = "foobar" // namesからnameに変わっている tags = ["foo", "bar"] } ``` -------------------------------- ### Basic VPN Router Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/vpn_router.md This snippet shows a basic configuration for a standard VPN router with internet connectivity. ```terraform resource "sakura_vpn_router" "standard" { name = "standard" description = "description" tags = ["tag1", "tag2"] internet_connection = true } ``` -------------------------------- ### Certificate Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Manages SSL/TLS certificates for secure connections. ```APIDOC ## Schema for `certificate` ### Description Configuration for SSL/TLS certificates used by the Enhanced Load Balancer. ### Parameters #### Optional - **additional_certificate** (Attributes List) - Configuration for additional certificates. - **intermediate_cert** (String) - The intermediate certificate for the server. - **private_key** (String, Sensitive) - The private key for the server. - **server_cert** (String) - The server certificate. ### Read-Only Properties - **common_name** (String) - The common name of the certificate. - **subject_alt_names** (String) - The subject alternative names of the certificate. ### Nested Schema for `additional_certificate` #### Required - **private_key** (String, Sensitive) - The private key for the server. - **server_cert** (String) - The certificate for the server. #### Optional - **intermediate_cert** (String) - The intermediate certificate for the server. ``` -------------------------------- ### Appliance Shared Packet Filter Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Illustrates the migration of the 'packet_filter' field for apprun_shared from a Block syntax in v2 to a Single Attribute with nested settings in v3. ```hcl packet_filter { enabled = true settings { from_ip = "192.0.2.0" from_ip_prefix_length = "24" } } ``` ```hcl packet_filter = { enabled = true settings = [{ from_ip = "192.0.2.0" from_ip_prefix_length = "24" }] } ``` -------------------------------- ### Appliance Shared Traffics Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Shows the change in the 'traffics' field for apprun_shared, moving from a Block syntax in v2 to a List of Attributes in v3. ```hcl traffics { version_index = 0 percent = 100 } ``` ```hcl traffics = [{ version_index = 0 percent = 100 }] ``` -------------------------------- ### Migrate site_to_site_vpn from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `site_to_site_vpn` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl site_to_site_vpn { peer = "10.0.0.1" // ... } ``` ```hcl site_to_site_vpn = [{ peer = "10.0.0.1" // ... }] ``` -------------------------------- ### Sorry Server Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Defines the configuration for a 'Sorry Server' which is used as a fallback when all other servers are unavailable. ```APIDOC ## Nested Schema for `sorry_server` ### Description Configuration for a fallback server used when all primary servers are down. ### Parameters #### Required Parameters - **ip_address** (String) - Required - The IP address of the SorryServer. This will be used when all servers are down. - **port** (Number) - Required - The port number of the SorryServer. This will be used when all servers are down. ``` -------------------------------- ### Syslog Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Configures the settings for sending logs to a syslog server. ```APIDOC ## Nested Schema for `syslog` ### Description Configuration for the syslog server. ### Parameters #### Required Parameters - **port** (Number) - Required - The number of syslog port. - **server** (String) - Required - The address of syslog server. ``` -------------------------------- ### Migrate site_to_site_vpn_parameter from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `site_to_site_vpn_parameter` field and its nested fields changed from Blocks to a Single Attribute. Update the structure accordingly. ```hcl site_to_site_vpn_parameter { ike { lifetime = 28800 dpd { interval = 15 timeout = 30 } } esp { lifetime = 1800 } encryption_algo = "aes256" // ... } ``` ```hcl site_to_site_vpn_parameter = { ike = { lifetime = 28800 dpd = { interval = 15 timeout = 30 } } esp = { lifetime = 1800 } encryption_algo = "aes256" // ... } ``` -------------------------------- ### Provider Configuration Migration (v2 to v3) Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md Shows the necessary changes in the Terraform configuration to switch from the 'sakuracloud' provider to the 'sakura' provider in v3. ```hcl terraform { required_providers { sakuracloud = { source = "sacloud/sakuracloud" } } } provider "sakuracloud" { zone = "tk1b" } ``` ```hcl terraform { required_providers { sakura = { source = "sacloud/sakura" } } } provider "sakura" { zone = "tk1b" } ``` -------------------------------- ### Bind Port Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Defines the network port configuration for the Enhanced Load Balancer, including proxy modes and HTTP/2 support. ```APIDOC ## Schema for `bind_port` ### Description Configuration for a listening port on the Enhanced Load Balancer. ### Parameters #### Required - **port** (Number) - The number of the listening port. - **proxy_mode** (String) - The proxy mode. Must be one of [`http`, `https`, `tcp`]. #### Optional - **redirect_to_https** (Boolean) - Enables redirection from HTTP to HTTPS. Used only when `proxy_mode` is `http`. - **response_header** (Attributes List) - Configuration for response headers. - **ssl_policy** (String) - The SSL policy. Must be one of [`TLS-1-2-2019-04`, `TLS-1-2-2021-06`, `TLS-1-3-2021-06`]. - **support_http2** (Boolean) - Enables HTTP/2. Used only when `proxy_mode` is `https`. ### Nested Schema for `response_header` #### Required - **header** (String) - The field name of the HTTP header added to the response. - **value** (String) - The field value of the HTTP header added to the response. ``` -------------------------------- ### Migrate firewall and expression from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `firewall` field and its nested `expression` changed from Block to List Attributes. Update the structure to use lists for both. ```hcl firewall { interface_index = 1 direction = "send" expression { protocol = "tcp" // ... } // ... } ``` ```hcl firewall = [{ interface_index = 1 direction = "send" expression = [ { protocol = "tcp" // ... }, // ... ] } ``` -------------------------------- ### Timeouts Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Sets custom timeouts for create, delete, and update operations. ```APIDOC ## Nested Schema for `timeouts` ### Description Customizable timeouts for various operations. ### Parameters #### Optional Parameters - **create** (String) - Optional - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). - **delete** (String) - Optional - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. - **update** (String) - Optional - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). ``` -------------------------------- ### Strict Rule Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Enables or disables strict rule enforcement for the load balancer. ```APIDOC ## Nested Schema for `strict_rule` ### Description Configuration to enable or disable strict rule enforcement. ### Parameters #### Required Parameters - **enabled** (Boolean) - Required - The flag to enable strict rule. ``` -------------------------------- ### Migrate pptp from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `pptp` field changed from a Block to a Single Attribute. Update the structure accordingly. ```hcl pptp { range_start = "192.168.11.31" // ... } ``` ```hcl pptp = { range_start = "192.168.11.31" // ... } ``` -------------------------------- ### Health Check Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Configures health checks for backend servers to monitor their availability. ```APIDOC ## Schema for `health_check` ### Description Configuration for health checks performed on backend servers. ### Parameters #### Required - **protocol** (String) - The protocol used for health checks. Must be one of [`http`, `tcp`]. #### Optional - **delay_loop** (Number) - The interval in seconds between checks. Must be in the range [`10`-`60`]. - **host_header** (String) - The value of the Host header sent during HTTP health checks. - **path** (String) - The path used for HTTP health checks. ``` -------------------------------- ### Migrate user from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `user` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl user { name = "username" // ... } ``` ```hcl user = [{ name = "username" // ... }] ``` -------------------------------- ### Migrate Packet Filter expression to packet_filter_rules resource Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `expression` field has been removed from the `sakuracloud_packet_filter` resource. Use the new `sakura_packet_filter_rules` resource to define filter rules. ```hcl resource "sakuracloud_packet_filter" "foobar" { name = "foobar" description = "description" expression { protocol = "tcp" destination_port = "22" } } ``` ```hcl resource "sakura_packet_filter" "foobar" { name = "foobar" description = "description" } resource "sakura_packet_filter_rules" "rules" { packet_filter_id = sakura_packet_filter.foobar.id expression = [{ protocol = "tcp" destination_port = "22" }] } ``` -------------------------------- ### Migrate dhcp_static_mapping from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `dhcp_static_mapping` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl dhcp_static_mapping { ip_address = "192.168.11.10" // ... } ``` ```hcl dhcp_static_mapping = [{ ip_address = "192.168.11.10" // ... }] ``` -------------------------------- ### Update Server network_interface from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `network_interface` field for Server resources has changed from a block type to a list attribute type. Ensure multiple network interfaces are defined within square brackets. ```hcl network_interface { upstream = "shared" packet_filter_id = data.sakuracloud_packet_filter.foobar.id } network_interface { // その他の設定 } ``` ```hcl network_interface = [ { upstream = "shared" packet_filter_id = data.sakura_packet_filter.foobar.id }, { // その他の設定 } ] ``` -------------------------------- ### Migrate private_network_interface from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `private_network_interface` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl private_network_interface { index = 1 // ... } ``` ```hcl private_network_interface = [{ index = 1 // ... }] ``` -------------------------------- ### Update Local Router static_route/peer from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `static_route` and `peer` fields for Local Router have changed from block types to list attribute types. Enclose multiple entries within square brackets. ```hcl static_route { prefix = "10.0.0.0/24" next_hop = "192.168.11.2" } static_route { prefix = "172.16.0.0/16" next_hop = "192.168.11.3" } peer { peer_id = data.sakuracloud_local_router.peer.id // ... } ``` ```hcl static_route = [{ prefix = "10.0.0.0/24" next_hop = "192.168.11.2" }, { prefix = "172.16.0.0/16" next_hop = "192.168.11.3" }] peer = [{ peer_id = data.sakura_local_router.peer.id }] ``` -------------------------------- ### Rule Configuration Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/docs/resources/enhanced_lb.md Defines rules for advanced traffic routing based on various conditions. ```APIDOC ## Schema for `rule` ### Description Configuration for rules that define how the Enhanced Load Balancer handles incoming requests. ### Parameters #### Optional - **action** (String) - The type of action to perform when a rule matches. Must be one of [`forward`, `redirect`, `fixed`]. - **fixed_content_type** (String) - The Content-Type header value for a fixed response. Must be one of [`text/plain`, `text/html`, `application/javascript`, `application/json`]. - **fixed_message_body** (String) - The content body for a fixed response. - **fixed_status_code** (String) - The HTTP status code for a fixed response. Must be one of [`200`, `403`, `503`]. - **group** (String) - The name of the load balancing group. Length must be between [`1`-`10`]. - **host** (String) - The HTTP Host header value used as a condition for rule-based balancing. - **path** (String) - The request path used as a condition for rule-based balancing. - **redirect_location** (String) - The URL to redirect to when a rule matches. - **redirect_status_code** (String) - The HTTP status code for redirects. Must be one of [`301`, `302`]. - **request_header_name** (String) - The name of the request header to check. - **request_header_value** (String) - The value condition for the request header. - **request_header_value_ignore_case** (Boolean) - Whether to ignore case when matching the request header value. - **request_header_value_not_match** (Boolean) - Whether to apply rules when the request header value conditions do not match. - **source_ips** (String) - IP address or CIDR block to which the rule applies. Multiple values can be separated by space or comma. ``` -------------------------------- ### Migrate dhcp_server from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `dhcp_server` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl dhcp_server { interface_index = 1 // ... } ``` ```hcl dhcp_server = [{ interface_index = 1 // ... }] ``` -------------------------------- ### Update Local Router switch/network_interface from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `switch` and `network_interface` fields for Local Router have changed from block types to single attribute types. Adjust your configuration to reflect this change. ```hcl switch { code = sakuracloud_switch.foobar.id // .... } network_interface { vip = "192.168.11.1" // ... } ``` ```hcl switch = { code = sakura_vswitch.foobar.id // .... } network_interface = { vip = "192.168.11.1" // ... } ``` -------------------------------- ### Migrate public_network_interface from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `public_network_interface` field changed from a Block to a Single Attribute. Update `switch_id` to `vswitch_id`. ```hcl public_network_interface { switch_id = sakura_internet.foobar.switch_id // ... } ``` ```hcl public_network_interface = { vswitch_id = sakura_internet.foobar.vswitch_id // ... } ``` -------------------------------- ### Migrate static_route from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `static_route` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl static_route { prefix = "172.16.0.0/16" // ... } ``` ```hcl static_route = [{ prefix = "172.16.0.0/16" // ... }] ``` -------------------------------- ### Update Server disk_edit_parameter from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `disk_edit_parameter` field for Server resources has changed from a block type to a single attribute type. Update your configuration to use the new format. ```hcl disk_edit_parameter { hostname = "foobar" password = "foobar-password" ssh_key_ids = ["xxxxxxxxxxxx"] // ... } ``` ```hcl disk_edit_parameter = { hostname = "foobar" password = "foobar-password" ssh_key_ids = ["xxxxxxxxxxxx"] // ... } ``` -------------------------------- ### Migrate wire_guard from Block to Single Attribute with List Peers Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `wire_guard` field changed to a Single Attribute, and its nested `peer` field changed to a List Attribute. Update the structure accordingly. ```hcl wire_guard { ip_address = "192.168.31.1/24" peer { name = "example" // ... } } ``` ```hcl wire_guard = { ip_address = "192.168.31.1/24" peer = [{ name = "example" // ... }] } ``` -------------------------------- ### Migrate static_nat from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `static_nat` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl static_nat { public_ip = sakura_internet.foobar.ip_addresses[3] // ... } ``` ```hcl static_nat = [{ public_ip = sakura_internet.foobar.ip_addresses[3] // ... }] ``` -------------------------------- ### Migrate l2tp from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `l2tp` field changed from a Block to a Single Attribute. Update the structure accordingly. ```hcl l2tp { pre_shared_secret = "example" // ... } ``` ```hcl l2tp = { pre_shared_secret = "example" // ... } ``` -------------------------------- ### Update GSLB server from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `server` field in GSLB resources has changed from a block type to a list attribute type. Ensure your server configurations are enclosed in a list. ```hcl server { ip_address = "192.2.0.11" weight = 1 enabled = true } ``` ```hcl server = [{ ip_address = "192.2.0.11" weight = 1 enabled = true }] ``` -------------------------------- ### Migrate port_forwarding from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `port_forwarding` field changed from a Block to a List Attribute. Ensure it is enclosed in square brackets. ```hcl port_forwarding { protocol = "udp" // ... } ``` ```hcl port_forwarding = [{ protocol = "udp" // ... }] ``` -------------------------------- ### Migrate dns_forwarding from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `dns_forwarding` field changed from a Block to a Single Attribute. Update the structure accordingly. ```hcl dns_forwarding { interface_index = 1 // ... } ``` ```hcl dns_forwarding = { interface_index = 1 // ... } ``` -------------------------------- ### Update Simple Monitor health_check from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `health_check` field in Simple Monitor resources has changed from a block type to a single attribute type. Update your configuration to use the new format. ```hcl health_check { protocol = "https" // ... } ``` ```hcl health_check = { protocol = "https" // ... } ``` -------------------------------- ### Update NFS network_interface from Block to Single Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `network_interface` field for NFS resources has changed from a block type to a single attribute type. Update your configuration to use the new format. ```hcl network_interface { switch_id = sakuracloud_switch.foobar.id ip_address = "192.168.11.101" netmask = 24 gateway = "192.168.11.1" } ``` ```hcl network_interface = { vswitch_id = sakura_vswitch.foobar.id ip_address = "192.168.11.101" netmask = 24 gateway = "192.168.11.1" } ``` -------------------------------- ### Update Packet Filter Rules expression from Block to List Attribute Source: https://github.com/sacloud/terraform-provider-sakura/blob/main/CHANGES.md The `expression` field within `sakura_packet_filter_rules` has changed from a block type to a list attribute type. Enclose multiple expressions within square brackets. ```hcl expression { protocol = "tcp" destination_port = "22" } expression { protocol = "udp" source_port = "123" } ``` ```hcl expression = [ { protocol = "tcp" destination_port = "22" }, { protocol = "udp" source_port = "123" } ] ```