alicloud_apig_environment

更新时间:2025-04-24 13:40:14

Provides a APIG Environment resource.

For information about APIG Environment and how to use it, see What is Environment.

-> NOTE: Available since v1.240.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "cn-hangzhou"
}

data "alicloud_resource_manager_resource_groups" "default" {}

data "alicloud_vpcs" "default" {
  name_regex = "^default-NODELETING$"
}
data "alicloud_vswitches" "default" {
  vpc_id = data.alicloud_vpcs.default.ids.0
}

resource "alicloud_apig_gateway" "defaultgateway" {
  network_access_config {
    type = "Intranet"
  }
  vswitch {
    vswitch_id = data.alicloud_vswitches.default.ids.0
  }
  zone_config {
    select_option = "Auto"
  }
  vpc {
    vpc_id = data.alicloud_vpcs.default.ids.0
  }
  payment_type = "PayAsYouGo"
  gateway_name = format("%s2", var.name)
  spec         = "apigw.small.x1"
  log_config {
    sls {
    }
  }
}

resource "alicloud_apig_environment" "default" {
  description       = var.name
  environment_name  = var.name
  gateway_id        = alicloud_apig_gateway.defaultgateway.id
  resource_group_id = data.alicloud_resource_manager_resource_groups.default.ids.1
}

Argument Reference

The following arguments are supported:

  • description - (Optional) Description
  • environment_name - (Required, ForceNew) The name of the resource
  • gateway_id - (Required, ForceNew) Gateway id
  • resource_group_id - (Optional, Computed) The ID of the resource group

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.

Timeouts

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

  • create - (Defaults to 5 mins) Used when create the Environment.
  • delete - (Defaults to 5 mins) Used when delete the Environment.
  • update - (Defaults to 5 mins) Used when update the Environment.

Import

APIG Environment can be imported using the id, e.g.

$ terraform import alicloud_apig_environment.example <id>

  • 本页导读 (1)
  • Example Usage
  • Argument Reference
  • Attributes Reference
  • Timeouts
  • Import
AI助理

点击开启售前

在线咨询服务

你好,我是AI助理

可以解答问题、推荐解决方案等