alicloud_api_gateway_instance
更新时间:
Provides a Api Gateway Instance resource.
For information about Api Gateway Instance and how to use it, see What is Instance.
-> NOTE: Available since v1.218.0.
Example Usage
Basic Usage
variable "name" {
default = "terraform-example"
}
provider "alicloud" {
region = "cn-hangzhou"
}
resource "alicloud_api_gateway_instance" "default" {
instance_name = var.name
instance_spec = "api.s1.small"
https_policy = "HTTPS2_TLS1_0"
zone_id = "cn-hangzhou-MAZ6"
payment_type = "PayAsYouGo"
instance_type = "normal"
}
variable "name" {
default = "terraform-example"
}
provider "alicloud" {
region = "cn-hangzhou"
}
resource "alicloud_vpc" "vpc" {
cidr_block = "172.16.0.0/12"
vpc_name = var.name
}
resource "alicloud_vswitch" "vswitch_1" {
vpc_id = alicloud_vpc.vpc.id
cidr_block = "172.16.0.0/16"
zone_id = "cn-hangzhou-j"
vswitch_name = "${var.name}_1"
}
resource "alicloud_vswitch" "vswitch_2" {
vpc_id = alicloud_vpc.vpc.id
cidr_block = "172.17.0.0/16"
zone_id = "cn-hangzhou-k"
vswitch_name = "${var.name}_2"
}
resource "alicloud_security_group" "security_group" {
vpc_id = alicloud_vpc.vpc.id
name = var.name
}
resource "alicloud_api_gateway_instance" "vpc_integration_instance" {
instance_name = var.name
https_policy = "HTTPS2_TLS1_0"
instance_spec = "api.s1.small"
instance_type = "vpc_connect"
payment_type = "PayAsYouGo"
user_vpc_id = alicloud_vpc.vpc.id
instance_cidr = "192.168.0.0/16"
zone_vswitch_security_group {
zone_id = alicloud_vswitch.vswitch_1.zone_id
vswitch_id = alicloud_vswitch.vswitch_1.id
cidr_block = alicloud_vswitch.vswitch_1.cidr_block
security_group = alicloud_security_group.security_group.id
}
zone_vswitch_security_group {
zone_id = alicloud_vswitch.vswitch_2.zone_id
vswitch_id = alicloud_vswitch.vswitch_2.id
cidr_block = alicloud_vswitch.vswitch_2.cidr_block
security_group = alicloud_security_group.security_group.id
}
}
Argument Reference
The following arguments are supported:
duration
- (Optional) The time of the instance package. Valid values:- PricingCycle is Month, indicating monthly payment. The value range is 1 to 9.
- PricingCycle is Year, indicating annual payment. The value range is 1 to 3.
When the value of> ChargeType is PrePaid, this parameter is available and must be passed in.
egress_ipv6_enable
- (Optional) Specifies whether IPv6 egress capability is enabled.https_policy
- (Required) Https policy.instance_name
- (Required) Instance name.instance_spec
- (Required, ForceNew) Instance type.instance_type
- (Optional, ForceNew, Computed) The type of the instance. Valid values are:normal
: traditional dedicated instance (default).vpc_connect
: Vpc integration instance. When this type is selected,instance_cidr
,user_vpc_id
andzone_vswitch_security_group
must be specified.
payment_type
- (Required, ForceNew) The payment type of the resource.pricing_cycle
- (Optional) The subscription instance is of the subscription year or month type. This parameter is required when the Payment type is PrePaid. The value range is as follows:year
: year.month
: month.
ipv6_enabled
- (Optional, Available since v1.228.0) Specifies whether IPv6 ingress capability is enabled.user_vpc_id
- (Optional, ForceNew) User's VpcID.vpc_slb_intranet_enable
- (Optional) Whether the slb of the Vpc supports.zone_id
- (Optional, ForceNew) The zone where the instance is deployed.instance_cidr
- (Optional, ForceNew, Available since v1.228.0) The CIDR block for the instance deployment. Valid values are:192.168.0.0/16
.172.16.0.0/12
.
zone_vswitch_security_group
- (Optional, ForceNew, Available since v1.228.0) Network configuration details for Vpc integration instance which includes the availability zone, VSwitch, and security group information. Seezone_vswitch_security_group
below.to_connect_vpc_ip_block
- (Optional, Available since v1.228.0) The additional IP block that the VPC integration instance can access, conflict withdelete_vpc_ip_block
. Seeto_connect_vpc_ip_block
below.delete_vpc_ip_block
- (Optional, Available since v1.228.0) Indicates whether to delete the IP block that the VPC can access, conflict withto_connect_vpc_ip_block
.
zone_vswitch_security_group
The zone_vswitch_security_group supports the following:
zone_id
- (Required) The zone ID.vswitch_id
- (Required) The VSwitch ID.cidr_block
- (Required) The CIDR block of the VSwitch.security_group
- (Required) The ID of the security group.
to_connect_vpc_ip_block
The to_connect_vpc_ip_block supports the following:
zone_id
- (Optional) The zone ID.vswitch_id
- (Optional) The VSwitch ID.cidr_block
- (Required) The CIDR block of the VSwitch.customized
- (Optional) Specifies whether the IP block is customized.
Attributes Reference
The following attributes are exported:
id
- The ID of the resource supplied above.create_time
- Creation time.status
- The status of the resource.support_ipv6
- Does ipv6 support.connect_cidr_blocks
- (Available since v1.228.0) The CIDR blocks that can be accessed by the Vpc integration instance.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 25 mins) Used when create the Instance.delete
- (Defaults to 25 mins) Used when delete the Instance.update
- (Defaults to 25 mins) Used when update the Instance.
Import
Api Gateway Instance can be imported using the id, e.g.
$ terraform import alicloud_api_gateway_instance.example <id>
文档内容是否对您有帮助?