alicloud_ga_additional_certificate

更新时间:

Provides a Global Accelerator (GA) Additional Certificate resource.

For information about Global Accelerator (GA) Additional Certificate and how to use it, see What is Additional Certificate.

-> NOTE: Available since v1.150.0.

Example Usage

Basic Usage


variable "region" {
  default = "cn-hangzhou"
}

provider "alicloud" {
  region  = var.region
  profile = "default"
}

resource "alicloud_ga_accelerator" "default" {
  duration        = 1
  auto_use_coupon = true
  spec            = "2"
}

resource "alicloud_ga_bandwidth_package" "default" {
  bandwidth      = 100
  type           = "Basic"
  bandwidth_type = "Basic"
  payment_type   = "PayAsYouGo"
  billing_type   = "PayBy95"
  ratio          = 30
}

resource "alicloud_ga_bandwidth_package_attachment" "default" {
  accelerator_id       = alicloud_ga_accelerator.default.id
  bandwidth_package_id = alicloud_ga_bandwidth_package.default.id
}

resource "alicloud_ssl_certificates_service_certificate" "default" {
  count            = 2
  certificate_name = join("-", ["terraform-example", count.index])
  cert             = <<EOF
-----BEGIN CERTIFICATE-----
MIIDRjCCAq+gAwIBAgIJAJn3ox4K13PoMA0GCSqGSIb3DQEBBQUAMHYxCzAJBgNV
BAYTAkNOMQswCQYDVQQIEwJCSjELMAkGA1UEBxMCQkoxDDAKBgNVBAoTA0FMSTEP
MA0GA1UECxMGQUxJWVVOMQ0wCwYDVQQDEwR0ZXN0MR8wHQYJKoZIhvcNAQkBFhB0
ZXN0QGhvdG1haWwuY29tMB4XDTE0MTEyNDA2MDQyNVoXDTI0MTEyMTA2MDQyNVow
djELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAkJKMQswCQYDVQQHEwJCSjEMMAoGA1UE
ChMDQUxJMQ8wDQYDVQQLEwZBTElZVU4xDTALBgNVBAMTBHRlc3QxHzAdBgkqhkiG
9w0BCQEWEHRlc3RAaG90bWFpbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBAM7SS3e9+Nj0HKAsRuIDNSsS3UK6b+62YQb2uuhKrp1HMrOx61WSDR2qkAnB
coG00Uz38EE+9DLYNU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MnCVuAKXCKj5FeIsgVtfluPOsZjPzz
71QQWS1dAkEA0T0KXO8gaBQwJhIoo/w6hy5JGZnrNSpOPp5xvJuMAafs2eyvmhJm
Ev9SN/Pf2VYa1z6FEnBaLOVD6hf6YQIsPQJAX/CZPoW6dzwgvimo1/GcY6eleiWE
qygqjWhsh71e/3bz7yuEAnj5yE3t7Zshcp+dXR3xxGo0eSuLfLFxHgGxwQJAAxf8
9DzQ5NkPkTCJi0sqbl8/03IUKTgT6hcbpWdDXa7m8J3wRr3o5nUB+TPQ5nzAbthM
zWX931YQeACcwhxvHQJBAN5mTzzJD4w4Ma6YTaNHyXakdYfyAWrOkPIWZxfhMfXe
DrlNdiysTI4Dd1dLeErVpjsckAaOW/JDG5PCSwkaMxk=
-----END RSA PRIVATE KEY-----
EOF
}

resource "alicloud_ga_listener" "default" {
  accelerator_id = alicloud_ga_bandwidth_package_attachment.default.accelerator_id
  name           = "terraform-example"
  protocol       = "HTTPS"
  port_ranges {
    from_port = 8080
    to_port   = 8080
  }
  certificates {
    id = join("-", [alicloud_ssl_certificates_service_certificate.default.0.id, var.region])
  }
}

resource "alicloud_ga_additional_certificate" "default" {
  certificate_id = join("-", [alicloud_ssl_certificates_service_certificate.default.1.id, var.region])
  domain         = "test"
  accelerator_id = alicloud_ga_accelerator.default.id
  listener_id    = alicloud_ga_listener.default.id
}

Argument Reference

The following arguments are supported:

  • accelerator_id - (Required, ForceNew) The ID of the GA instance.
  • listener_id - (Required, ForceNew) The ID of the listener. NOTE: Only HTTPS listeners support this parameter.
  • domain - (Required, ForceNew) The domain name specified by the certificate. NOTE: You can associate each domain name with only one additional certificate.
  • certificate_id - (Required) The Certificate ID. NOTE: From version 1.209.1, certificate_id can be modified.

Attributes Reference

The following attributes are exported:

  • id - The resource ID of Additional Certificate. The value format as <accelerator_id>:<listener_id>:<domain>.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 3 mins) Used to wait accelerator and listener to be active after creating the Ga additional certificate.
  • update - (Defaults to 3 mins) Used to wait accelerator and listener to be active after updating the Ga additional certificate.
  • delete - (Defaults to 3 mins) Used to wait accelerator and listener to be active after deleting the Ga additional certificate.

Import

Global Accelerator (GA) Additional Certificate can be imported using the id, e.g.

$ terraform import alicloud_ga_additional_certificate.example <accelerator_id>:<listener_id>:<domain>