@@ -43,6 +43,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
4343 IDENTITY_DOMAIN_ID = "identity_domain_id"
4444 PASSWORD_SECRET_ID = "password_secret_id"
4545 PASSWORD_SECRET_ID_2 = "password_secret_id_2"
46+ GROUP_ID = "group_id"
4647 )
4748
4849 var (
@@ -73,6 +74,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
7374 passwordSecretId2 = utils .GetEnvSettingWithBlankDefault (PASSWORD_SECRET_ID_2 )
7475 baseOggVersion = utils .GetEnvSettingWithBlankDefault (BASE_OGG_VERSION )
7576 upgradedOggVersion = utils .GetEnvSettingWithBlankDefault (UPGRADED_OGG_VERSION )
77+ groupId = utils .GetEnvSettingWithBlankDefault (GROUP_ID )
7678
7779 resId string
7880 resId2 string
@@ -93,6 +95,20 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
9395 "key" : acctest.Representation {RepType : acctest .Optional , Update : `${var.key}` },
9496 }
9597
98+ groupToRolesMappingRepresentation = map [string ]interface {}{
99+ "security_group_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.group_id}` },
100+ "administrator_group_id" : acctest.Representation {RepType : acctest .Optional , Update : `${var.group_id}` },
101+ "operator_group_id" : acctest.Representation {RepType : acctest .Optional , Update : `${var.group_id}` },
102+ "user_group_id" : acctest.Representation {RepType : acctest .Optional , Update : `${var.group_id}` },
103+ }
104+
105+ goldenGateDeploymentOggDataWithGroupRoleMappingRepresentation = map [string ]interface {}{
106+ "admin_password" : acctest.Representation {RepType : acctest .Required , Create : `${var.password}` },
107+ "admin_username" : acctest.Representation {RepType : acctest .Required , Create : `adminUsername` },
108+ "deployment_name" : acctest.Representation {RepType : acctest .Required , Create : `depl_test_ggs_deployment_name` },
109+ "group_to_roles_mapping" : acctest.RepresentationGroup {RepType : acctest .Required , Group : groupToRolesMappingRepresentation },
110+ }
111+
96112 deploymentMaintenanceConfigurationRepresentation = map [string ]interface {}{
97113 "bundle_release_upgrade_period_in_days" : acctest.Representation {RepType : acctest .Optional , Create : `10` , Update : `11` },
98114 "interim_release_upgrade_period_in_days" : acctest.Representation {RepType : acctest .Optional , Create : `5` , Update : `6` },
@@ -182,6 +198,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
182198 makeVariableStr (NEW_PASSWORD , t ) +
183199 makeVariableStr (PASSWORD_SECRET_ID , t ) +
184200 makeVariableStr (PASSWORD_SECRET_ID_2 , t ) +
201+ makeVariableStr (GROUP_ID , t ) +
185202 GoldenGateDeploymentResourceDependencies
186203
187204 if identityDomainId != "" {
@@ -192,7 +209,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
192209 acctest .SaveConfigContent (config + testDeploymentIdVariableStr +
193210 acctest .GenerateResourceFromRepresentationMap ("oci_golden_gate_deployment" , "depl_test_ggs_deployment" , acctest .Optional , acctest .Create , goldenGateDeploymentRepresentation ), "goldengate" , "deployment" , t )
194211
195- acctest . ResourceTest ( t , testAccCheckGoldenGateDeploymentDestroy , []resource.TestStep {
212+ var steps = []resource.TestStep {
196213 // verify Create
197214 {
198215 Config : config + testDeploymentIdVariableStr +
@@ -220,6 +237,39 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
220237 ),
221238 },
222239
240+ // delete before next Create
241+ {
242+ Config : config ,
243+ },
244+ // check groupToRolesMapping attribute set
245+ {
246+ Config : config + testDeploymentIdVariableStr + acctest .GenerateResourceFromRepresentationMap ("oci_golden_gate_deployment" , "depl_test_ggs_deployment" , acctest .Required , acctest .Create ,
247+ acctest .RepresentationCopyWithNewProperties (goldenGateDeploymentRepresentation , map [string ]interface {}{
248+ "deployment_type" : acctest.Representation {RepType : acctest .Required , Create : `OGG` },
249+ "ogg_data" : acctest.RepresentationGroup {RepType : acctest .Required , Group : goldenGateDeploymentOggDataWithGroupRoleMappingRepresentation },
250+ })),
251+
252+ Check : acctest .ComposeAggregateTestCheckFuncWrapper (
253+ resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
254+ resource .TestCheckResourceAttr (resourceName , "cpu_core_count" , "1" ),
255+ resource .TestCheckResourceAttr (resourceName , "deployment_type" , "OGG" ),
256+ resource .TestCheckResourceAttr (resourceName , "display_name" , "Terraform_integration_test" ),
257+ resource .TestCheckResourceAttr (resourceName , "is_auto_scaling_enabled" , "false" ),
258+ resource .TestCheckResourceAttrSet (resourceName , "subnet_id" ),
259+ resource .TestCheckResourceAttr (resourceName , "license_model" , "LICENSE_INCLUDED" ),
260+ resource .TestCheckResourceAttr (resourceName , "ogg_data.#" , "1" ),
261+ resource .TestCheckResourceAttr (resourceName , "ogg_data.0.admin_username" , "adminUsername" ),
262+ resource .TestCheckResourceAttrSet (resourceName , "ogg_data.0.deployment_name" ),
263+ resource .TestCheckResourceAttrSet (resourceName , "ogg_data.0.ogg_version" ),
264+ resource .TestCheckResourceAttr (resourceName , "ogg_data.0.group_to_roles_mapping.#" , "1" ),
265+ resource .TestCheckResourceAttr (resourceName , "ogg_data.0.group_to_roles_mapping.0.security_group_id" , groupId ),
266+
267+ func (s * terraform.State ) (err error ) {
268+ resId , err = acctest .FromInstanceState (s , resourceName , "id" )
269+ return err
270+ },
271+ ),
272+ },
223273 // delete before next Create
224274 {
225275 Config : config ,
@@ -685,7 +735,8 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
685735 {
686736 Config : config ,
687737 },
688- })
738+ }
739+ acctest .ResourceTest (t , testAccCheckGoldenGateDeploymentDestroy , steps )
689740}
690741
691742func testAccCheckGoldenGateDeploymentDestroy (s * terraform.State ) error {
0 commit comments