diff --git a/alicloud/provider.go b/alicloud/provider.go index 1328d94f994d..958331f5f573 100644 --- a/alicloud/provider.go +++ b/alicloud/provider.go @@ -1374,7 +1374,7 @@ func Provider() terraform.ResourceProvider { "alicloud_privatelink_vpc_endpoint_zone": resourceAliCloudPrivateLinkVpcEndpointZone(), "alicloud_ga_accelerator": resourceAliCloudGaAccelerator(), "alicloud_eci_container_group": resourceAlicloudEciContainerGroup(), - "alicloud_resource_manager_shared_resource": resourceAlicloudResourceManagerSharedResource(), + "alicloud_resource_manager_shared_resource": resourceAliCloudResourceManagerSharedResource(), "alicloud_resource_manager_shared_target": resourceAlicloudResourceManagerSharedTarget(), "alicloud_ga_listener": resourceAliCloudGaListener(), "alicloud_tsdb_instance": resourceAlicloudTsdbInstance(), diff --git a/alicloud/resource_alicloud_resource_manager_shared_resource.go b/alicloud/resource_alicloud_resource_manager_shared_resource.go index 5ee456cbede5..e440e081f4a9 100644 --- a/alicloud/resource_alicloud_resource_manager_shared_resource.go +++ b/alicloud/resource_alicloud_resource_manager_shared_resource.go @@ -11,11 +11,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) -func resourceAlicloudResourceManagerSharedResource() *schema.Resource { +func resourceAliCloudResourceManagerSharedResource() *schema.Resource { return &schema.Resource{ - Create: resourceAlicloudResourceManagerSharedResourceCreate, - Read: resourceAlicloudResourceManagerSharedResourceRead, - Delete: resourceAlicloudResourceManagerSharedResourceDelete, + Create: resourceAliCloudResourceManagerSharedResourceCreate, + Read: resourceAliCloudResourceManagerSharedResourceRead, + Delete: resourceAliCloudResourceManagerSharedResourceDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -38,7 +38,7 @@ func resourceAlicloudResourceManagerSharedResource() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: StringInSlice([]string{"VSwitch", "ROSTemplate", "ServiceCatalogPortfolio", "PrefixList", "Image", "PublicIpAddressPool", "KMSInstance"}, false), + ValidateFunc: StringInSlice([]string{"VSwitch", "ROSTemplate", "ServiceCatalogPortfolio", "PrefixList", "Image", "PublicIpAddressPool", "KMSInstance", "Snapshot"}, false), }, "status": { Type: schema.TypeString, @@ -48,7 +48,7 @@ func resourceAlicloudResourceManagerSharedResource() *schema.Resource { } } -func resourceAlicloudResourceManagerSharedResourceCreate(d *schema.ResourceData, meta interface{}) error { +func resourceAliCloudResourceManagerSharedResourceCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) resourcesharingService := ResourcesharingService{client} var response map[string]interface{} @@ -88,10 +88,10 @@ func resourceAlicloudResourceManagerSharedResourceCreate(d *schema.ResourceData, return WrapErrorf(err, IdMsg, d.Id()) } - return resourceAlicloudResourceManagerSharedResourceRead(d, meta) + return resourceAliCloudResourceManagerSharedResourceRead(d, meta) } -func resourceAlicloudResourceManagerSharedResourceRead(d *schema.ResourceData, meta interface{}) error { +func resourceAliCloudResourceManagerSharedResourceRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) resourcesharingService := ResourcesharingService{client} object, err := resourcesharingService.DescribeResourceManagerSharedResource(d.Id()) @@ -117,7 +117,7 @@ func resourceAlicloudResourceManagerSharedResourceRead(d *schema.ResourceData, m return nil } -func resourceAlicloudResourceManagerSharedResourceDelete(d *schema.ResourceData, meta interface{}) error { +func resourceAliCloudResourceManagerSharedResourceDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*connectivity.AliyunClient) parts, err := ParseResourceId(d.Id(), 3) if err != nil { diff --git a/alicloud/resource_alicloud_resource_manager_shared_resource_test.go b/alicloud/resource_alicloud_resource_manager_shared_resource_test.go index 173a13050d82..960039b2eb5d 100644 --- a/alicloud/resource_alicloud_resource_manager_shared_resource_test.go +++ b/alicloud/resource_alicloud_resource_manager_shared_resource_test.go @@ -20,10 +20,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) -func TestAccAlicloudResourceManagerSharedResource_basic(t *testing.T) { +func TestAccAliCloudResourceManagerSharedResource_basic(t *testing.T) { var v map[string]interface{} resourceId := "alicloud_resource_manager_shared_resource.default" - ra := resourceAttrInit(resourceId, AlicloudResourceManagerSharedResourceMap) + ra := resourceAttrInit(resourceId, AliCloudResourceManagerSharedResourceMap) rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { return &ResourcesharingService{testAccProvider.Meta().(*connectivity.AliyunClient)} }, "DescribeResourceManagerSharedResource") @@ -31,7 +31,7 @@ func TestAccAlicloudResourceManagerSharedResource_basic(t *testing.T) { testAccCheck := rac.resourceAttrMapUpdateSet() rand := acctest.RandIntRange(10000, 99999) name := fmt.Sprintf("tf-testAccResourceManagerSharedResource%d", rand) - testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudResourceManagerSharedResourceBasicDependence) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AliCloudResourceManagerSharedResourceBasicDependence) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -64,10 +64,10 @@ func TestAccAlicloudResourceManagerSharedResource_basic(t *testing.T) { }) } -func TestAccAlicloudResourceManagerSharedResource_prefixList(t *testing.T) { +func TestAccAliCloudResourceManagerSharedResource_prefixList(t *testing.T) { var v map[string]interface{} resourceId := "alicloud_resource_manager_shared_resource.default" - ra := resourceAttrInit(resourceId, AlicloudResourceManagerSharedResourceMap) + ra := resourceAttrInit(resourceId, AliCloudResourceManagerSharedResourceMap) rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { return &ResourcesharingService{testAccProvider.Meta().(*connectivity.AliyunClient)} }, "DescribeResourceManagerSharedResource") @@ -75,7 +75,7 @@ func TestAccAlicloudResourceManagerSharedResource_prefixList(t *testing.T) { testAccCheck := rac.resourceAttrMapUpdateSet() rand := acctest.RandIntRange(10000, 99999) name := fmt.Sprintf("tf-testAccResourceManagerSharedResource%d", rand) - testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudResourceManagerSharedResourcePrefixListDependence) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AliCloudResourceManagerSharedResourcePrefixListDependence) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -108,10 +108,10 @@ func TestAccAlicloudResourceManagerSharedResource_prefixList(t *testing.T) { }) } -func TestAccAlicloudResourceManagerSharedResource_image(t *testing.T) { +func TestAccAliCloudResourceManagerSharedResource_image(t *testing.T) { var v map[string]interface{} resourceId := "alicloud_resource_manager_shared_resource.default" - ra := resourceAttrInit(resourceId, AlicloudResourceManagerSharedResourceMap) + ra := resourceAttrInit(resourceId, AliCloudResourceManagerSharedResourceMap) rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} { return &ResourcesharingService{testAccProvider.Meta().(*connectivity.AliyunClient)} }, "DescribeResourceManagerSharedResource") @@ -119,7 +119,7 @@ func TestAccAlicloudResourceManagerSharedResource_image(t *testing.T) { testAccCheck := rac.resourceAttrMapUpdateSet() rand := acctest.RandIntRange(10000, 99999) name := fmt.Sprintf("tf-testAccResourceManagerSharedResource%d", rand) - testAccConfig := resourceTestAccConfigFunc(resourceId, name, AlicloudResourceManagerSharedResourceImageDependence) + testAccConfig := resourceTestAccConfigFunc(resourceId, name, AliCloudResourceManagerSharedResourceImageDependence) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -152,11 +152,11 @@ func TestAccAlicloudResourceManagerSharedResource_image(t *testing.T) { }) } -var AlicloudResourceManagerSharedResourceMap = map[string]string{ +var AliCloudResourceManagerSharedResourceMap = map[string]string{ "status": "Associated", } -func AlicloudResourceManagerSharedResourceBasicDependence(name string) string { +func AliCloudResourceManagerSharedResourceBasicDependence(name string) string { return fmt.Sprintf(` variable "name" { default = "%s" @@ -181,7 +181,7 @@ func AlicloudResourceManagerSharedResourceBasicDependence(name string) string { `, name) } -func AlicloudResourceManagerSharedResourcePrefixListDependence(name string) string { +func AliCloudResourceManagerSharedResourcePrefixListDependence(name string) string { return fmt.Sprintf(` variable "name" { default = "%s" @@ -204,7 +204,7 @@ func AlicloudResourceManagerSharedResourcePrefixListDependence(name string) stri `, name) } -func AlicloudResourceManagerSharedResourceImageDependence(name string) string { +func AliCloudResourceManagerSharedResourceImageDependence(name string) string { return fmt.Sprintf(` variable "name" { default = "%s" @@ -267,7 +267,7 @@ func AlicloudResourceManagerSharedResourceImageDependence(name string) string { `, name) } -func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { +func TestUnitAliCloudResourceManagerSharedResource(t *testing.T) { p := Provider().(*schema.Provider).ResourcesMap dInit, _ := schema.InternalMap(p["alicloud_resource_manager_shared_resource"].Schema).Data(nil, nil) dExisted, _ := schema.InternalMap(p["alicloud_resource_manager_shared_resource"].Schema).Data(nil, nil) @@ -341,7 +341,7 @@ func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { StatusCode: tea.Int(400), } }) - err = resourceAlicloudResourceManagerSharedResourceCreate(dInit, rawClient) + err = resourceAliCloudResourceManagerSharedResourceCreate(dInit, rawClient) patches.Reset() assert.NotNil(t, err) ReadMockResponseDiff := map[string]interface{}{ @@ -373,7 +373,7 @@ func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { } return ReadMockResponse, nil }) - err := resourceAlicloudResourceManagerSharedResourceCreate(dInit, rawClient) + err := resourceAliCloudResourceManagerSharedResourceCreate(dInit, rawClient) patches.Reset() switch errorCode { case "NonRetryableError": @@ -418,7 +418,7 @@ func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { } return ReadMockResponse, nil }) - err := resourceAlicloudResourceManagerSharedResourceRead(dExisted, rawClient) + err := resourceAliCloudResourceManagerSharedResourceRead(dExisted, rawClient) patches.Reset() switch errorCode { case "NonRetryableError": @@ -437,7 +437,7 @@ func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { StatusCode: tea.Int(400), } }) - err = resourceAlicloudResourceManagerSharedResourceDelete(dExisted, rawClient) + err = resourceAliCloudResourceManagerSharedResourceDelete(dExisted, rawClient) patches.Reset() assert.NotNil(t, err) attributesDiff = map[string]interface{}{} @@ -472,7 +472,7 @@ func TestUnitAlicloudResourceManagerSharedResource(t *testing.T) { } return ReadMockResponse, nil }) - err := resourceAlicloudResourceManagerSharedResourceDelete(dExisted, rawClient) + err := resourceAliCloudResourceManagerSharedResourceDelete(dExisted, rawClient) patches.Reset() switch errorCode { case "NonRetryableError": diff --git a/website/docs/r/resource_manager_shared_resource.html.markdown b/website/docs/r/resource_manager_shared_resource.html.markdown index b48118583159..ca844d77f650 100644 --- a/website/docs/r/resource_manager_shared_resource.html.markdown +++ b/website/docs/r/resource_manager_shared_resource.html.markdown @@ -68,6 +68,7 @@ The following arguments are supported: - The following types are added after v1.192.0: `PrefixList` and `Image`. - The following types are added after v1.194.1: `PublicIpAddressPool`. - The following types are added after v1.208.0: `KMSInstance`. + - The following types are added after v1.240.0: `Snapshot`. ## Attributes Reference