@@ -722,6 +722,30 @@ func testAccCheckProSubscriptionDestroy(s *terraform.State) error {
722722 return nil
723723}
724724
725+ func TestAccResourceRedisCloudProSubscription_CMEK (t * testing.T ) {
726+
727+ //testAccRequiresEnvVar(t, "EXECUTE_TESTS")
728+
729+ name := acctest .RandomWithPrefix (testResourcePrefix )
730+ const resourceName = "rediscloud_subscription.example"
731+ testCloudAccountName := os .Getenv ("AWS_TEST_CLOUD_ACCOUNT_NAME" )
732+
733+ resource .ParallelTest (t , resource.TestCase {
734+ PreCheck : func () { testAccPreCheck (t ); testAccAwsPreExistingCloudAccountPreCheck (t ) },
735+ ProviderFactories : providerFactories ,
736+ CheckDestroy : testAccCheckProSubscriptionDestroy ,
737+ Steps : []resource.TestStep {
738+ {
739+ Config : fmt .Sprintf (testAccResourceRedisCloudProSubscriptionCmekEnabled_part1 , testCloudAccountName , name ),
740+ Check : resource .ComposeAggregateTestCheckFunc (
741+ resource .TestCheckResourceAttr (resourceName , "name" , name ),
742+ resource .TestCheckResourceAttr (resourceName , "cloud_provider.0.region.0.preferred_availability_zones.#" , "1" ),
743+ ),
744+ },
745+ },
746+ })
747+ }
748+
725749// TF config for provisioning a new subscription.
726750const testAccResourceRedisCloudProSubscription = `
727751data "rediscloud_payment_method" "card" {
@@ -770,6 +794,78 @@ resource "rediscloud_subscription" "example" {
770794}
771795`
772796
797+ const testAccResourceRedisCloudProSubscriptionCmekEnabled_part1 = `
798+ data "rediscloud_payment_method" "card" {
799+ card_type = "Visa"
800+ }
801+
802+ data "rediscloud_cloud_account" "account" {
803+ exclude_internal_account = true
804+ provider_type = "AWS"
805+ name = "%s"
806+ }
807+
808+ resource "rediscloud_subscription" "example" {
809+
810+ name = "%s"
811+ payment_method = "credit-card"
812+ payment_method_id = data.rediscloud_payment_method.card.id
813+ memory_storage = "ram"
814+ cmek_enabled = true
815+
816+ allowlist {
817+ cidrs = ["192.168.0.0/16"]
818+ security_group_ids = []
819+ }
820+
821+ cloud_provider {
822+ provider = data.rediscloud_cloud_account.account.provider_type
823+ cloud_account_id = data.rediscloud_cloud_account.account.id
824+ region {
825+ region = "eu-west-1"
826+ networking_deployment_cidr = "10.0.0.0/24"
827+ preferred_availability_zones = ["eu-west-1a"]
828+ }
829+ }
830+ }
831+ `
832+
833+ const testAccResourceRedisCloudProSubscriptionCmekEnabled_update = `
834+ data "rediscloud_payment_method" "card" {
835+ card_type = "Visa"
836+ }
837+
838+ data "rediscloud_cloud_account" "account" {
839+ exclude_internal_account = true
840+ provider_type = "AWS"
841+ name = "%s"
842+ }
843+
844+ resource "rediscloud_subscription" "example" {
845+
846+ name = "%s"
847+ payment_method = "credit-card"
848+ payment_method_id = data.rediscloud_payment_method.card.id
849+ memory_storage = "ram"
850+ cmek_enabled = true
851+
852+ allowlist {
853+ cidrs = ["192.168.0.0/16"]
854+ security_group_ids = []
855+ }
856+
857+ cloud_provider {
858+ provider = data.rediscloud_cloud_account.account.provider_type
859+ cloud_account_id = data.rediscloud_cloud_account.account.id
860+ region {
861+ region = "eu-west-1"
862+ networking_deployment_cidr = "10.0.0.0/24"
863+ preferred_availability_zones = ["eu-west-1a"]
864+ }
865+ }
866+ }
867+ `
868+
773869const testAccResourceRedisCloudProSubscriptionWithRedisVersion = `
774870data "rediscloud_payment_method" "card" {
775871 card_type = "Visa"
0 commit comments