@@ -36,25 +36,25 @@ var (
3636 }
3737
3838 autoScalingConfigurationRepresentation = map [string ]interface {}{
39+ "auto_scaling_resources" : RepresentationGroup {Required , autoScalingConfigurationAutoScalingResourcesRepresentation },
3940 "compartment_id" : Representation {repType : Required , create : `${var.compartment_id}` },
4041 "policies" : RepresentationGroup {Required , autoScalingConfigurationPoliciesRepresentation },
41- "auto_scaling_resources" : RepresentationGroup {Required , autoScalingConfigurationResourceRepresentation },
4242 "cool_down_in_seconds" : Representation {repType : Optional , create : `300` , update : `400` },
4343 "defined_tags" : Representation {repType : Optional , create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
4444 "display_name" : Representation {repType : Optional , create : `displayName` , update : `displayName2` },
4545 "freeform_tags" : Representation {repType : Optional , create : map [string ]string {"Department" : "Finance" }, update : map [string ]string {"Department" : "Accounting" }},
4646 "is_enabled" : Representation {repType : Optional , create : `false` , update : `true` },
4747 }
48+ autoScalingConfigurationAutoScalingResourcesRepresentation = map [string ]interface {}{
49+ "id" : Representation {repType : Required , create : `${oci_core_instance_pool.test_instance_pool.id}` },
50+ "type" : Representation {repType : Required , create : `instancePool` },
51+ }
4852 autoScalingConfigurationPoliciesRepresentation = map [string ]interface {}{
4953 "capacity" : RepresentationGroup {Required , autoScalingConfigurationPoliciesCapacityRepresentation },
5054 "policy_type" : Representation {repType : Required , create : `threshold` , update : `threshold` },
5155 "rules" : []RepresentationGroup {{Required , autoScalingConfigurationPoliciesScaleOutRuleRepresentation }, {Required , autoScalingConfigurationPoliciesScaleInRuleRepresentation }},
5256 "display_name" : Representation {repType : Optional , create : `displayName` , update : `displayName2` },
5357 }
54- autoScalingConfigurationResourceRepresentation = map [string ]interface {}{
55- "id" : Representation {repType : Required , create : `${oci_core_instance_pool.test_instance_pool.id}` },
56- "type" : Representation {repType : Required , create : `instancePool` },
57- }
5858 autoScalingConfigurationPoliciesCapacityRepresentation = map [string ]interface {}{
5959 "initial" : Representation {repType : Required , create : `2` , update : `4` },
6060 "max" : Representation {repType : Required , create : `3` , update : `5` },
@@ -127,6 +127,9 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
127127 Config : config + compartmentIdVariableStr + AutoScalingConfigurationResourceDependencies +
128128 generateResourceFromRepresentationMap ("oci_autoscaling_auto_scaling_configuration" , "test_auto_scaling_configuration" , Required , Create , autoScalingConfigurationRepresentation ),
129129 Check : resource .ComposeAggregateTestCheckFunc (
130+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
131+ resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
132+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
130133 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
131134 resource .TestCheckResourceAttr (resourceName , "policies.#" , "1" ),
132135 resource .TestCheckResourceAttr (resourceName , "policies.0.capacity.#" , "1" ),
@@ -157,9 +160,6 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
157160 "metric.0.threshold.0.value" : "1" ,
158161 },
159162 []string {}),
160- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
161- resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
162- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
163163
164164 func (s * terraform.State ) (err error ) {
165165 resId , err = fromInstanceState (s , resourceName , "id" )
@@ -177,6 +177,9 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
177177 Config : config + compartmentIdVariableStr + AutoScalingConfigurationResourceDependencies +
178178 generateResourceFromRepresentationMap ("oci_autoscaling_auto_scaling_configuration" , "test_auto_scaling_configuration" , Optional , Create , autoScalingConfigurationRepresentation ),
179179 Check : resource .ComposeAggregateTestCheckFunc (
180+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
181+ resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
182+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
180183 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
181184 resource .TestCheckResourceAttr (resourceName , "cool_down_in_seconds" , "300" ),
182185 resource .TestCheckResourceAttr (resourceName , "defined_tags.%" , "1" ),
@@ -218,9 +221,6 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
218221 },
219222 []string {}),
220223 resource .TestCheckResourceAttrSet (resourceName , "policies.0.time_created" ),
221- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
222- resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
223- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
224224 resource .TestCheckResourceAttrSet (resourceName , "time_created" ),
225225
226226 func (s * terraform.State ) (err error ) {
@@ -235,6 +235,9 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
235235 Config : config + compartmentIdVariableStr + AutoScalingConfigurationResourceDependencies +
236236 generateResourceFromRepresentationMap ("oci_autoscaling_auto_scaling_configuration" , "test_auto_scaling_configuration" , Optional , Update , autoScalingConfigurationRepresentation ),
237237 Check : resource .ComposeAggregateTestCheckFunc (
238+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
239+ resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
240+ resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
238241 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
239242 resource .TestCheckResourceAttr (resourceName , "cool_down_in_seconds" , "400" ),
240243 resource .TestCheckResourceAttr (resourceName , "defined_tags.%" , "1" ),
@@ -276,9 +279,6 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
276279 },
277280 []string {}),
278281 resource .TestCheckResourceAttrSet (resourceName , "policies.0.time_created" ),
279- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.#" , "1" ),
280- resource .TestCheckResourceAttrSet (resourceName , "auto_scaling_resources.0.id" ),
281- resource .TestCheckResourceAttr (resourceName , "auto_scaling_resources.0.type" , "instancePool" ),
282282 resource .TestCheckResourceAttrSet (resourceName , "time_created" ),
283283
284284 func (s * terraform.State ) (err error ) {
@@ -301,14 +301,14 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
301301 resource .TestCheckResourceAttr (datasourceName , "display_name" , "displayName2" ),
302302
303303 resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.#" , "1" ),
304+ resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.#" , "1" ),
305+ resource .TestCheckResourceAttrSet (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.0.id" ),
306+ resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.0.type" , "instancePool" ),
304307 resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.compartment_id" , compartmentId ),
305308 resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.cool_down_in_seconds" , "400" ),
306309 resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.display_name" , "displayName2" ),
307310 resource .TestCheckResourceAttrSet (datasourceName , "auto_scaling_configurations.0.id" ),
308311 resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.is_enabled" , "true" ),
309- resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.#" , "1" ),
310- resource .TestCheckResourceAttrSet (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.0.id" ),
311- resource .TestCheckResourceAttr (datasourceName , "auto_scaling_configurations.0.auto_scaling_resources.0.type" , "instancePool" ),
312312 resource .TestCheckResourceAttrSet (datasourceName , "auto_scaling_configurations.0.time_created" ),
313313 ),
314314 },
@@ -320,6 +320,9 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
320320 Check : resource .ComposeAggregateTestCheckFunc (
321321 resource .TestCheckResourceAttrSet (singularDatasourceName , "auto_scaling_configuration_id" ),
322322
323+ resource .TestCheckResourceAttr (singularDatasourceName , "auto_scaling_resources.#" , "1" ),
324+ resource .TestCheckResourceAttrSet (singularDatasourceName , "auto_scaling_resources.0.id" ),
325+ resource .TestCheckResourceAttr (singularDatasourceName , "auto_scaling_resources.0.type" , "instancePool" ),
323326 resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
324327 resource .TestCheckResourceAttr (singularDatasourceName , "cool_down_in_seconds" , "400" ),
325328 resource .TestCheckResourceAttr (singularDatasourceName , "defined_tags.%" , "1" ),
@@ -360,9 +363,6 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
360363 },
361364 []string {}),
362365 resource .TestCheckResourceAttrSet (singularDatasourceName , "policies.0.time_created" ),
363- resource .TestCheckResourceAttr (singularDatasourceName , "auto_scaling_resources.#" , "1" ),
364- resource .TestCheckResourceAttrSet (singularDatasourceName , "auto_scaling_resources.0.id" ),
365- resource .TestCheckResourceAttr (singularDatasourceName , "auto_scaling_resources.0.type" , "instancePool" ),
366366 resource .TestCheckResourceAttrSet (singularDatasourceName , "time_created" ),
367367 ),
368368 },
0 commit comments