@@ -1152,4 +1152,108 @@ func TestAccAliCloudKmsInstance_basic5405_twin(t *testing.T) {
11521152 })
11531153}
11541154
1155+ func TestAccAliCloudKmsInstance_postpaid_log_enabled (t * testing.T ) {
1156+ var v map [string ]interface {}
1157+ resourceId := "alicloud_kms_instance.default"
1158+ ra := resourceAttrInit (resourceId , AlicloudKmsInstanceMapLogEnabled )
1159+ rc := resourceCheckInitWithDescribeMethod (resourceId , & v , func () interface {} {
1160+ return & KmsServiceV2 {testAccProvider .Meta ().(* connectivity.AliyunClient )}
1161+ }, "DescribeKmsInstance" )
1162+ rac := resourceAttrCheckInit (rc , ra )
1163+ testAccCheck := rac .resourceAttrMapUpdateSet ()
1164+ rand := acctest .RandIntRange (10000 , 99999 )
1165+ name := fmt .Sprintf ("tf-testacc%skmsinstance%d" , defaultRegionToTest , rand )
1166+ testAccConfig := resourceTestAccConfigFunc (resourceId , name , AlicloudKmsInstanceBasicDependenceLogEnabled )
1167+ resource .Test (t , resource.TestCase {
1168+ PreCheck : func () {
1169+ testAccPreCheck (t )
1170+ testAccPreCheckWithAccountSiteType (t , DomesticSite )
1171+ testAccPreCheckWithRegions (t , true , []connectivity.Region {"cn-wulanchabu" })
1172+ },
1173+ IDRefreshName : resourceId ,
1174+ Providers : testAccProviders ,
1175+ CheckDestroy : rac .checkResourceDestroy (),
1176+ Steps : []resource.TestStep {
1177+ {
1178+ Config : testAccConfig (map [string ]interface {}{
1179+ "payment_type" : "PayAsYouGo" ,
1180+ "product_version" : "3" ,
1181+ "log" : "1" ,
1182+ "log_storage" : "1000" ,
1183+ "vpc_id" : "${alicloud_vpc.vpc-amp-instance-example.id}" ,
1184+ "zone_ids" : []string {
1185+ "${alicloud_vswitch.vswitcha.zone_id}" , "${alicloud_vswitch.vswitchb.zone_id}" },
1186+ "vswitch_ids" : []string {
1187+ "${alicloud_vswitch.vswitcha.id}" },
1188+ "force_delete_without_backup" : "true" ,
1189+ }),
1190+ Check : resource .ComposeTestCheckFunc (
1191+ testAccCheck (map [string ]string {
1192+ "payment_type" : "PayAsYouGo" ,
1193+ "product_version" : "3" ,
1194+ "log" : "1" ,
1195+ "log_storage" : "1000" ,
1196+ "vpc_id" : CHECKSET ,
1197+ "zone_ids.#" : "2" ,
1198+ "vswitch_ids.#" : "1" ,
1199+ }),
1200+ ),
1201+ },
1202+ {
1203+ Config : testAccConfig (map [string ]interface {}{
1204+ "log_storage" : "2000" ,
1205+ }),
1206+ Check : resource .ComposeTestCheckFunc (
1207+ testAccCheck (map [string ]string {
1208+ "log_storage" : "2000" ,
1209+ }),
1210+ ),
1211+ },
1212+ {
1213+ ResourceName : resourceId ,
1214+ ImportState : true ,
1215+ ImportStateVerify : true ,
1216+ ImportStateVerifyIgnore : []string {"force_delete_without_backup" , "log_storage" },
1217+ },
1218+ },
1219+ })
1220+ }
1221+
1222+ var AlicloudKmsInstanceMapLogEnabled = map [string ]string {
1223+ "status" : CHECKSET ,
1224+ "create_time" : CHECKSET ,
1225+ "end_date" : CHECKSET ,
1226+ "instance_name" : CHECKSET ,
1227+ "ca_certificate_chain_pem" : CHECKSET ,
1228+ "payment_type" : "PayAsYouGo" ,
1229+ "product_version" : "3" ,
1230+ "log" : "1" ,
1231+ "log_storage" : "1000" ,
1232+ }
1233+
1234+ func AlicloudKmsInstanceBasicDependenceLogEnabled (name string ) string {
1235+ return fmt .Sprintf (`
1236+ variable "name" {
1237+ default = "%s"
1238+ }
1239+
1240+ resource "alicloud_vpc" "vpc-amp-instance-example" {
1241+ cidr_block = "172.16.0.0/12"
1242+ vpc_name = var.name
1243+ }
1244+
1245+ resource "alicloud_vswitch" "vswitcha" {
1246+ vpc_id = alicloud_vpc.vpc-amp-instance-example.id
1247+ zone_id = "cn-wulanchabu-a"
1248+ cidr_block = "172.16.1.0/24"
1249+ }
1250+
1251+ resource "alicloud_vswitch" "vswitchb" {
1252+ vpc_id = alicloud_vpc.vpc-amp-instance-example.id
1253+ zone_id = "cn-wulanchabu-b"
1254+ cidr_block = "172.16.2.0/24"
1255+ }
1256+ ` , name )
1257+ }
1258+
11551259// Test Kms Instance. <<< Resource test cases, automatically generated.
0 commit comments