@@ -76,7 +76,7 @@ func TestApmConfigOptionsResource_basic(t *testing.T) {
7676 datasourceOptionsName := "data.oci_apm_config_configs.test_optionss"
7777 singularOptionsDatasourceName := "data.oci_apm_config_config.test_options"
7878
79- var resId string
79+ var resId , resId2 string
8080 // Save TF content to create resource with optional properties. This has to be exactly the same as the config part in the "create with optionals" step in the test.
8181 acctest .SaveConfigContent (config + compartmentIdVariableStr + ApmConfigConfigResourceDependencies +
8282 acctest .GenerateResourceFromRepresentationMap ("oci_apm_config_config" , "test_options" , acctest .Optional , acctest .Create , configOptionsRepresentation ), "apmconfig" , "config" , t )
@@ -140,11 +140,37 @@ func TestApmConfigOptionsResource_basic(t *testing.T) {
140140 },
141141 ),
142142 },
143- // Step 4: delete Options before next create
143+ // Step 4: verify updates to Options updatable parameters
144+ {
145+ Config : config + compartmentIdVariableStr + ApmConfigConfigResourceDependencies +
146+ acctest .GenerateResourceFromRepresentationMap ("oci_apm_config_config" , "test_options" , acctest .Optional , acctest .Update , configOptionsRepresentation ),
147+ Check : acctest .ComposeAggregateTestCheckFuncWrapper (
148+ resource .TestCheckResourceAttrSet (optionsResourceName , "apm_domain_id" ),
149+ resource .TestCheckResourceAttrSet (optionsResourceName , "id" ),
150+ resource .TestCheckResourceAttr (optionsResourceName , "config_type" , configTypeOptions ),
151+ resource .TestCheckResourceAttr (optionsResourceName , "display_name" , "displayName2" ),
152+ resource .TestCheckResourceAttr (optionsResourceName , "group" , "group2" ),
153+ resource .TestCheckResourceAttrSet (optionsResourceName , "options" ),
154+ resource .TestCheckResourceAttr (optionsResourceName , "freeform_tags.%" , "1" ),
155+ resource .TestCheckResourceAttr (optionsResourceName , "defined_tags.%" , "1" ),
156+ resource .TestCheckResourceAttrSet (optionsResourceName , "created_by" ),
157+ resource .TestCheckResourceAttrSet (optionsResourceName , "updated_by" ),
158+ resource .TestCheckResourceAttrSet (optionsResourceName , "etag" ),
159+
160+ func (s * terraform.State ) (err error ) {
161+ resId2 , err = acctest .FromInstanceState (s , optionsResourceName , "id" )
162+ if resId != resId2 {
163+ return fmt .Errorf ("Resource recreated when it was supposed to be updated." )
164+ }
165+ return err
166+ },
167+ ),
168+ },
169+ // Step 5: delete Options before next create
144170 {
145171 Config : config + compartmentIdVariableStr + ApmConfigConfigResourceDependencies ,
146172 },
147- // Step 5 : verify datasource
173+ // Step 6 : verify datasource
148174 {
149175 Config : config +
150176 acctest .GenerateDataSourceFromRepresentationMap ("oci_apm_config_configs" , "test_optionss" , acctest .Optional , acctest .Update , configOptionsDataSourceRepresentation ) +
@@ -159,7 +185,7 @@ func TestApmConfigOptionsResource_basic(t *testing.T) {
159185 resource .TestCheckResourceAttr (datasourceOptionsName , "config_collection.0.items.#" , "1" ),
160186 ),
161187 },
162- // Step 6 : verify singular datasource
188+ // Step 7 : verify singular datasource
163189 {
164190 Config : config +
165191 acctest .GenerateDataSourceFromRepresentationMap ("oci_apm_config_config" , "test_options" , acctest .Required , acctest .Create , configOptionsSingularDataSourceRepresentation ) +
@@ -179,7 +205,7 @@ func TestApmConfigOptionsResource_basic(t *testing.T) {
179205 resource .TestCheckResourceAttrSet (singularOptionsDatasourceName , "updated_by" ),
180206 ),
181207 },
182- // Step 7 verify resource import
208+ // Step 8 verify resource import
183209 {
184210 Config : config + ConfigOptionsRequiredOnlyResource ,
185211 ImportState : true ,
0 commit comments