From 2abd75948e604d9bc46ad8bc1978d80dead4ca56 Mon Sep 17 00:00:00 2001 From: chenhanzhang Date: Thu, 26 Dec 2024 15:02:57 +0800 Subject: [PATCH] New Resource: alicloud_apig_environment. --- alicloud/provider.go | 1 + .../resource_alicloud_apig_environment.go | 272 +++++++++++++++ ...resource_alicloud_apig_environment_test.go | 317 ++++++++++++++++++ alicloud/service_alicloud_apig_v2.go | 3 +- website/docs/r/apig_environment.html.markdown | 97 ++++++ 5 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 alicloud/resource_alicloud_apig_environment.go create mode 100644 alicloud/resource_alicloud_apig_environment_test.go create mode 100644 website/docs/r/apig_environment.html.markdown diff --git a/alicloud/provider.go b/alicloud/provider.go index 7b5360141f75..524c90471292 100644 --- a/alicloud/provider.go +++ b/alicloud/provider.go @@ -879,6 +879,7 @@ func Provider() terraform.ResourceProvider { "alicloud_cms_site_monitors": dataSourceAliCloudCloudMonitorServiceSiteMonitors(), }, ResourcesMap: map[string]*schema.Resource{ + "alicloud_apig_environment": resourceAliCloudApigEnvironment(), "alicloud_apig_gateway": resourceAliCloudApigGateway(), "alicloud_apig_http_api": resourceAliCloudApigHttpApi(), "alicloud_mongodb_private_srv_network_address": resourceAliCloudMongodbPrivateSrvNetworkAddress(), diff --git a/alicloud/resource_alicloud_apig_environment.go b/alicloud/resource_alicloud_apig_environment.go new file mode 100644 index 000000000000..2c40106c26a0 --- /dev/null +++ b/alicloud/resource_alicloud_apig_environment.go @@ -0,0 +1,272 @@ +// Package alicloud. This file is generated automatically. Please do not modify it manually, thank you! +package alicloud + +import ( + "fmt" + "log" + "time" + + "github.com/PaesslerAG/jsonpath" + util "github.com/alibabacloud-go/tea-utils/service" + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourceAliCloudApigEnvironment() *schema.Resource { + return &schema.Resource{ + Create: resourceAliCloudApigEnvironmentCreate, + Read: resourceAliCloudApigEnvironmentRead, + Update: resourceAliCloudApigEnvironmentUpdate, + Delete: resourceAliCloudApigEnvironmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(5 * time.Minute), + Delete: schema.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + }, + "environment_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "gateway_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "resource_group_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + } +} + +func resourceAliCloudApigEnvironmentCreate(d *schema.ResourceData, meta interface{}) error { + + client := meta.(*connectivity.AliyunClient) + + action := fmt.Sprintf("/v1/environments") + var request map[string]interface{} + var response map[string]interface{} + query := make(map[string]*string) + body := make(map[string]interface{}) + conn, err := client.NewApigClient() + if err != nil { + return WrapError(err) + } + request = make(map[string]interface{}) + + request["name"] = d.Get("environment_name") + if v, ok := d.GetOk("description"); ok { + request["description"] = v + } + request["gatewayId"] = d.Get("gateway_id") + if v, ok := d.GetOk("resource_group_id"); ok { + request["resourceGroupId"] = v + } + body = request + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2024-03-27"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), query, nil, body, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, "alicloud_apig_environment", action, AlibabaCloudSdkGoERROR) + } + + id, _ := jsonpath.Get("$.body.data.environmentId", response) + d.SetId(fmt.Sprint(id)) + + return resourceAliCloudApigEnvironmentRead(d, meta) +} + +func resourceAliCloudApigEnvironmentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + apigServiceV2 := ApigServiceV2{client} + + objectRaw, err := apigServiceV2.DescribeApigEnvironment(d.Id()) + if err != nil { + if !d.IsNewResource() && NotFoundError(err) { + log.Printf("[DEBUG] Resource alicloud_apig_environment DescribeApigEnvironment Failed!!! %s", err) + d.SetId("") + return nil + } + return WrapError(err) + } + + if objectRaw["description"] != nil { + d.Set("description", objectRaw["description"]) + } + if objectRaw["name"] != nil { + d.Set("environment_name", objectRaw["name"]) + } + if objectRaw["resourceGroupId"] != nil { + d.Set("resource_group_id", objectRaw["resourceGroupId"]) + } + + gatewayInfo1RawObj, _ := jsonpath.Get("$.gatewayInfo", objectRaw) + gatewayInfo1Raw := make(map[string]interface{}) + if gatewayInfo1RawObj != nil { + gatewayInfo1Raw = gatewayInfo1RawObj.(map[string]interface{}) + } + if gatewayInfo1Raw["gatewayId"] != nil { + d.Set("gateway_id", gatewayInfo1Raw["gatewayId"]) + } + + return nil +} + +func resourceAliCloudApigEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*connectivity.AliyunClient) + var request map[string]interface{} + var response map[string]interface{} + var query map[string]*string + var body map[string]interface{} + update := false + d.Partial(true) + + environmentId := d.Id() + action := fmt.Sprintf("/v1/environments/%s", environmentId) + conn, err := client.NewApigClient() + if err != nil { + return WrapError(err) + } + request = make(map[string]interface{}) + query = make(map[string]*string) + body = make(map[string]interface{}) + request["environmentId"] = d.Id() + + if d.HasChange("description") { + update = true + } + if v, ok := d.GetOk("description"); ok || d.HasChange("description") { + request["description"] = v + } + body = request + if update { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2024-03-27"), nil, StringPointer("PUT"), StringPointer("AK"), StringPointer(action), query, nil, body, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + update = false + action = fmt.Sprintf("/move-resource-group") + conn, err = client.NewApigClient() + if err != nil { + return WrapError(err) + } + request = make(map[string]interface{}) + query = make(map[string]*string) + body = make(map[string]interface{}) + query["ResourceId"] = StringPointer(d.Id()) + query["RegionId"] = StringPointer(client.RegionId) + if d.HasChange("resource_group_id") { + update = true + } + if v, ok := d.GetOk("resource_group_id"); ok { + query["ResourceGroupId"] = StringPointer(v.(string)) + } + + query["ResourceType"] = StringPointer("Environment") + body = request + if update { + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutUpdate), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2024-03-27"), nil, StringPointer("POST"), StringPointer("AK"), StringPointer(action), query, nil, body, &runtime) + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + if err != nil { + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + } + + d.Partial(false) + return resourceAliCloudApigEnvironmentRead(d, meta) +} + +func resourceAliCloudApigEnvironmentDelete(d *schema.ResourceData, meta interface{}) error { + + client := meta.(*connectivity.AliyunClient) + environmentId := d.Id() + action := fmt.Sprintf("/v1/environments/%s", environmentId) + var request map[string]interface{} + var response map[string]interface{} + query := make(map[string]*string) + conn, err := client.NewApigClient() + if err != nil { + return WrapError(err) + } + request = make(map[string]interface{}) + request["environmentId"] = d.Id() + + runtime := util.RuntimeOptions{} + runtime.SetAutoretry(true) + wait := incrementalWait(3*time.Second, 5*time.Second) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + response, err = conn.DoRequest(StringPointer("2024-03-27"), nil, StringPointer("DELETE"), StringPointer("AK"), StringPointer(action), query, nil, nil, &runtime) + + if err != nil { + if NeedRetry(err) { + wait() + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + addDebug(action, response, request) + + if err != nil { + if IsExpectedErrors(err, []string{"NotFound.EnvironmentNotFound"}) || NotFoundError(err) { + return nil + } + return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR) + } + + return nil +} diff --git a/alicloud/resource_alicloud_apig_environment_test.go b/alicloud/resource_alicloud_apig_environment_test.go new file mode 100644 index 000000000000..6fc13cf2dcae --- /dev/null +++ b/alicloud/resource_alicloud_apig_environment_test.go @@ -0,0 +1,317 @@ +package alicloud + +import ( + "fmt" + "testing" + + "github.com/aliyun/terraform-provider-alicloud/alicloud/connectivity" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +// Test Apig Environment. >>> Resource test cases, automatically generated. +// Case 资源组接入_副本1732759159298 9198 +func TestAccAliCloudApigEnvironment_basic9198(t *testing.T) { + var v map[string]interface{} + resourceId := "alicloud_apig_environment.default" + ra := resourceAttrInit(resourceId, AlicloudApigEnvironmentMap9198) + rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { + return &ApigServiceV2{testAccProvider.Meta().(*connectivity.AliyunClient)} + }, "DescribeApigEnvironment") + rac := resourceAttrCheckInit(rc, ra) + testAccCheck := rac.resourceAttrMapUpdateSet() + rand := acctest.RandIntRange(10000, 99999) + name := fmt.Sprintf("tf-testacc%sapigenvironment%d", defaultRegionToTest, rand) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudApigEnvironmentBasicDependence9198) + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheckWithRegions(t, true, []connectivity.Region{"cn-hangzhou"}) + testAccPreCheck(t) + }, + IDRefreshName: resourceId, + Providers: testAccProviders, + CheckDestroy: rac.checkResourceDestroy(), + Steps: []resource.TestStep{ + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": "${alicloud_apig_gateway.defaultgateway.id}", + "resource_group_id": "${data.alicloud_resource_manager_resource_groups.default.ids.1}", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": CHECKSET, + "resource_group_id": CHECKSET, + }), + ), + }, + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述更新了", + "resource_group_id": "${data.alicloud_resource_manager_resource_groups.default.ids.1}", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述更新了", + "resource_group_id": CHECKSET, + }), + ), + }, + { + ResourceName: resourceId, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{}, + }, + }, + }) +} + +var AlicloudApigEnvironmentMap9198 = map[string]string{} + +func AlicloudApigEnvironmentBasicDependence9198(name string) string { + return fmt.Sprintf(` +variable "name" { + default = "%s" +} + +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 { + } + } +} + + +`, name) +} + +// Case 资源组接入 9015 +func TestAccAliCloudApigEnvironment_basic9015(t *testing.T) { + var v map[string]interface{} + resourceId := "alicloud_apig_environment.default" + ra := resourceAttrInit(resourceId, AlicloudApigEnvironmentMap9015) + rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { + return &ApigServiceV2{testAccProvider.Meta().(*connectivity.AliyunClient)} + }, "DescribeApigEnvironment") + rac := resourceAttrCheckInit(rc, ra) + testAccCheck := rac.resourceAttrMapUpdateSet() + rand := acctest.RandIntRange(10000, 99999) + name := fmt.Sprintf("tf-testacc%sapigenvironment%d", defaultRegionToTest, rand) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudApigEnvironmentBasicDependence9015) + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheckWithRegions(t, true, []connectivity.Region{"cn-hangzhou"}) + testAccPreCheck(t) + }, + IDRefreshName: resourceId, + Providers: testAccProviders, + CheckDestroy: rac.checkResourceDestroy(), + Steps: []resource.TestStep{ + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": "${alicloud_apig_gateway.defaultgateway.id}", + "resource_group_id": "${data.alicloud_resource_manager_resource_groups.default.ids.0}", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": CHECKSET, + "resource_group_id": CHECKSET, + }), + ), + }, + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述更新了", + "resource_group_id": "${data.alicloud_resource_manager_resource_groups.default.ids.1}", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述更新了", + "resource_group_id": CHECKSET, + }), + ), + }, + { + ResourceName: resourceId, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{}, + }, + }, + }) +} + +var AlicloudApigEnvironmentMap9015 = map[string]string{} + +func AlicloudApigEnvironmentBasicDependence9015(name string) string { + return fmt.Sprintf(` +variable "name" { + default = "%s" +} + +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 { + } + } +} + +`, name) +} + +// Case env-test 7097 +func TestAccAliCloudApigEnvironment_basic7097(t *testing.T) { + var v map[string]interface{} + resourceId := "alicloud_apig_environment.default" + ra := resourceAttrInit(resourceId, AlicloudApigEnvironmentMap7097) + rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { + return &ApigServiceV2{testAccProvider.Meta().(*connectivity.AliyunClient)} + }, "DescribeApigEnvironment") + rac := resourceAttrCheckInit(rc, ra) + testAccCheck := rac.resourceAttrMapUpdateSet() + rand := acctest.RandIntRange(10000, 99999) + name := fmt.Sprintf("tf-testacc%sapigenvironment%d", defaultRegionToTest, rand) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudApigEnvironmentBasicDependence7097) + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheckWithRegions(t, true, []connectivity.Region{"cn-hangzhou"}) + testAccPreCheck(t) + }, + IDRefreshName: resourceId, + Providers: testAccProviders, + CheckDestroy: rac.checkResourceDestroy(), + Steps: []resource.TestStep{ + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": "${alicloud_apig_gateway.defaultgateway.id}", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述", + "environment_name": name, + "gateway_id": CHECKSET, + }), + ), + }, + { + Config: testAccConfig(map[string]interface{}{ + "description": "pop网关自动化测试描述更新了", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "description": "pop网关自动化测试描述更新了", + }), + ), + }, + { + ResourceName: resourceId, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{}, + }, + }, + }) +} + +var AlicloudApigEnvironmentMap7097 = map[string]string{} + +func AlicloudApigEnvironmentBasicDependence7097(name string) string { + return fmt.Sprintf(` +variable "name" { + default = "%s" +} + +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 { + } + } +} + + +`, name) +} + +// Test Apig Environment. <<< Resource test cases, automatically generated. diff --git a/alicloud/service_alicloud_apig_v2.go b/alicloud/service_alicloud_apig_v2.go index 02be3870c456..d6b02e989589 100644 --- a/alicloud/service_alicloud_apig_v2.go +++ b/alicloud/service_alicloud_apig_v2.go @@ -378,6 +378,7 @@ func (s *ApigServiceV2) SetResourceTags(d *schema.ResourceData, resourceType str } // SetResourceTags >>> tag function encapsulated. + // DescribeApigEnvironment <<< Encapsulated get interface for Apig Environment. func (s *ApigServiceV2) DescribeApigEnvironment(id string) (object map[string]interface{}, err error) { @@ -412,7 +413,7 @@ func (s *ApigServiceV2) DescribeApigEnvironment(id string) (object map[string]in }) addDebug(action, response, request) if response == nil { - return object, WrapErrorf(Error(GetNotFoundMessage("Environment", id)), NotFoundMsg, err) + return object, WrapErrorf(Error(GetNotFoundMessage("Environment", id)), NotFoundMsg, response) } response = response["body"].(map[string]interface{}) code, _ := jsonpath.Get("$.code", response) diff --git a/website/docs/r/apig_environment.html.markdown b/website/docs/r/apig_environment.html.markdown new file mode 100644 index 000000000000..0e11f498a551 --- /dev/null +++ b/website/docs/r/apig_environment.html.markdown @@ -0,0 +1,97 @@ +--- +subcategory: "APIG" +layout: "alicloud" +page_title: "Alicloud: alicloud_apig_environment" +description: |- + Provides a Alicloud APIG Environment resource. +--- + +# alicloud_apig_environment + +Provides a APIG Environment resource. + + + +For information about APIG Environment and how to use it, see [What is Environment](https://www.alibabacloud.com/help/en/). + +-> **NOTE:** Available since v1.240.0. + +## Example Usage + +Basic Usage + +```terraform +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](https://www.terraform.io/docs/configuration-0-11/resources.html#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. + +```shell +$ terraform import alicloud_apig_environment.example +``` \ No newline at end of file