alicloud_slb_domain_extension
更新时间:
HTTPS listeners of guaranteed-performance SLB support configuring multiple certificates, allowing you to forward requests with different domain names to different backend servers. Please refer to the documentation for details.
-> NOTE: Available in 1.60.0+
-> NOTE: The instance with shared loadBalancerSpec doesn't support domainExtension.
Example Usage
# Create a new load balancer and domain extension
variable "slb_domain_extension_name" {
default = "forDomainExtension"
}
data "alicloud_zones" "domain_extension" {
available_resource_creation = "VSwitch"
}
resource "alicloud_vpc" "domain_extension" {
vpc_name = var.slb_domain_extension_name
}
resource "alicloud_vswitch" "domain_extension" {
vpc_id = alicloud_vpc.domain_extension.id
cidr_block = "172.16.0.0/21"
zone_id = data.alicloud_zones.domain_extension.zones[0].id
vswitch_name = var.slb_domain_extension_name
}
resource "alicloud_slb_load_balancer" "instance" {
load_balancer_name = var.slb_domain_extension_name
address_type = "intranet"
load_balancer_spec = "slb.s2.small"
vswitch_id = alicloud_vswitch.domain_extension.id
}
resource "alicloud_slb_server_certificate" "domain_extension" {
name = "tf-testAccSlbServerCertificate"
server_certificate = "-----BEGIN CERTIFICATE-----\nMIIDdjCCAl4CCQCcm+erkcKN7DANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJj\nbjELMAkGA1UECAwCYmoxEDAOBgNVBAcMB2JlaWppbmcxDzANBgNVBAoMBmFsaXl1\nbjELMAkGA1UECwwCc2MxFTATBgNVBAMMDHd3dy50ZXN0LmNvbTEaMBgGCSqGSIb3\nDQEJARYLMTIzQDEyMy5jb20wHhcNMTkwNDI2MDM0ODAxWhcNMjQwNDI1MDM0ODAx\nWjB9MQswCQYDVQQGEwJjbjELMAkGA1UECAwCYmoxEDAOBgNVBAcMB2JlaWppbmcx\nDzANBgNVBAoMBmFsaXl1bjELMAkGA1UECwwCc2MxFTATBgNVBAMMDHd3dy50ZXN0\nLmNvbTEaMBgGCSqGSIb3DQEJARYLMTIzQDEyMy5jb20wggEiMA0GCSqGSIb3DQEB\nAQUAA4IBDwAwggEKAoIBAQDKMKF5qmN/uoM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pqrvOnYXlOVW/U+SqDQ\n8JDb1c/PVZGuY1KrXkR9HLiW3kz5IJ3S3PFdUVYdeTN8BQxXCyg4V12nJJtJs912\ny0zN3wKBgGDS6YttCN6aI4EOABYE8fI1EYQ7vhfiYsaWGWSR1l6bQey7KR6M1ACz\nZzMASNyytVt12yXE4/Emv6/pYqigbDLfL1zQJSLJ3EHJYTh2RxjR+AaGDudYFG/T\nliQ9YXhV5Iu2x1pNwrtFnssDdaaGpfA7l3xC00BL7Z+SAJyI4QKA\n-----END RSA PRIVATE KEY-----"
}
resource "alicloud_slb_listener" "https" {
load_balancer_id = alicloud_slb_load_balancer.instance.id
backend_port = 80
frontend_port = 443
protocol = "https"
sticky_session = "on"
sticky_session_type = "insert"
cookie = "testslblistenercookie"
cookie_timeout = 86400
health_check = "on"
health_check_uri = "/cons"
health_check_connect_port = 20
healthy_threshold = 8
unhealthy_threshold = 8
health_check_timeout = 8
health_check_interval = 5
health_check_http_code = "http_2xx,http_3xx"
bandwidth = 10
server_certificate_id = alicloud_slb_server_certificate.domain_extension.id
}
resource "alicloud_slb_domain_extension" "example1" {
load_balancer_id = alicloud_slb_load_balancer.instance.id
frontend_port = alicloud_slb_listener.https.frontend_port
domain = "www.test.com"
server_certificate_id = alicloud_slb_server_certificate.domain_extension.id
}
Argument Reference
The following arguments are supported:
load_balancer_id
- (Required, ForceNew) The ID of the SLB instance.frontend_port
- (Required, ForceNew) The frontend port used by the HTTPS listener of the SLB instance. Valid values: 1–65535.domain
- (Required, ForceNew) The domain name.server_certificate_id
- (Required) The ID of the certificate used by the domain name.delete_protection_validation
- (Optional, Available in 1.63.0+) Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
Attributes Reference
The following attributes are exported:
id
- The ID of the domain extension.
Import
Load balancer domain_extension can be imported using the id, e.g.
$ terraform import alicloud_slb_domain_extension.example de-abc123456
文档内容是否对您有帮助?