Skip to content

Commit 8e520a7

Browse files
committed
Return tags on listInstanceConfig/Pools and listAutoscalingConfiguration
1 parent b9748e3 commit 8e520a7

10 files changed

+110
-80
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Added
44
- Support for setting `compartment_id` argument in `object_storage_namespace` data source
55
- Support BGP dynamic routing and allow customer to input PSK for IPSec tunnels
6+
- ListInstanceConfig/Pools and ListAutoscalingConfiguration return tags
67

78
## 3.25.0 (May 15, 2019)
89

oci/autoscaling_auto_scaling_configuration_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var (
2929

3030
autoScalingConfigurationDataSourceRepresentation = map[string]interface{}{
3131
"compartment_id": Representation{repType: Required, create: `${var.compartment_id}`},
32-
"display_name": Representation{repType: Optional, create: `displayName`, update: `displayName2`},
32+
"display_name": Representation{repType: Optional, create: `example_autoscaling_configuration`, update: `displayName2`},
3333
"filter": RepresentationGroup{Required, autoScalingConfigurationDataSourceFilterRepresentation}}
3434
autoScalingConfigurationDataSourceFilterRepresentation = map[string]interface{}{
3535
"name": Representation{repType: Required, create: `id`},
@@ -42,7 +42,7 @@ var (
4242
"policies": RepresentationGroup{Required, autoScalingConfigurationPoliciesRepresentation},
4343
"cool_down_in_seconds": Representation{repType: Optional, create: `300`, update: `400`},
4444
"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")}`},
45-
"display_name": Representation{repType: Optional, create: `displayName`, update: `displayName2`},
45+
"display_name": Representation{repType: Optional, create: `example_autoscaling_configuration`, update: `displayName2`},
4646
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
4747
"is_enabled": Representation{repType: Optional, create: `false`, update: `true`},
4848
}
@@ -54,7 +54,7 @@ var (
5454
"capacity": RepresentationGroup{Required, autoScalingConfigurationPoliciesCapacityRepresentation},
5555
"policy_type": Representation{repType: Required, create: `threshold`, update: `threshold`},
5656
"rules": []RepresentationGroup{{Required, autoScalingConfigurationPoliciesScaleOutRuleRepresentation}, {Required, autoScalingConfigurationPoliciesScaleInRuleRepresentation}},
57-
"display_name": Representation{repType: Optional, create: `displayName`, update: `displayName2`},
57+
"display_name": Representation{repType: Optional, create: `example_autoscaling_configuration`, update: `displayName2`},
5858
}
5959
autoScalingConfigurationPoliciesCapacityRepresentation = map[string]interface{}{
6060
"initial": Representation{repType: Required, create: `2`, update: `4`},
@@ -184,7 +184,7 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
184184
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
185185
resource.TestCheckResourceAttr(resourceName, "cool_down_in_seconds", "300"),
186186
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
187-
resource.TestCheckResourceAttr(resourceName, "display_name", "displayName"),
187+
resource.TestCheckResourceAttr(resourceName, "display_name", "example_autoscaling_configuration"),
188188
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
189189
resource.TestCheckResourceAttrSet(resourceName, "id"),
190190
resource.TestCheckResourceAttr(resourceName, "is_enabled", "false"),
@@ -194,7 +194,7 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
194194
resource.TestCheckResourceAttr(resourceName, "policies.0.capacity.0.initial", "2"),
195195
resource.TestCheckResourceAttr(resourceName, "policies.0.capacity.0.max", "3"),
196196
resource.TestCheckResourceAttr(resourceName, "policies.0.capacity.0.min", "2"),
197-
resource.TestCheckResourceAttr(resourceName, "policies.0.display_name", "displayName"),
197+
resource.TestCheckResourceAttr(resourceName, "policies.0.display_name", "example_autoscaling_configuration"),
198198
resource.TestCheckResourceAttr(resourceName, "policies.0.policy_type", "threshold"),
199199
resource.TestCheckResourceAttr(resourceName, "policies.0.rules.#", "2"),
200200
CheckResourceSetContainsElementWithProperties(resourceName, "policies.0.rules", map[string]string{
@@ -307,7 +307,9 @@ func TestAutoscalingAutoScalingConfigurationResource_basic(t *testing.T) {
307307
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.auto_scaling_resources.0.type", "instancePool"),
308308
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.compartment_id", compartmentId),
309309
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.cool_down_in_seconds", "400"),
310+
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.defined_tags.%", "1"),
310311
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.display_name", "displayName2"),
312+
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.freeform_tags.%", "1"),
311313
resource.TestCheckResourceAttrSet(datasourceName, "auto_scaling_configurations.0.id"),
312314
resource.TestCheckResourceAttr(datasourceName, "auto_scaling_configurations.0.is_enabled", "true"),
313315
resource.TestCheckResourceAttrSet(datasourceName, "auto_scaling_configurations.0.time_created"),

oci/autoscaling_auto_scaling_configurations_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,16 @@ func (s *AutoscalingAutoScalingConfigurationsDataSourceCrud) SetData() error {
102102
autoScalingConfiguration["cool_down_in_seconds"] = *r.CoolDownInSeconds
103103
}
104104

105+
if r.DefinedTags != nil {
106+
autoScalingConfiguration["defined_tags"] = definedTagsToMap(r.DefinedTags)
107+
}
108+
105109
if r.DisplayName != nil {
106110
autoScalingConfiguration["display_name"] = *r.DisplayName
107111
}
108112

113+
autoScalingConfiguration["freeform_tags"] = r.FreeformTags
114+
109115
if r.Id != nil {
110116
autoScalingConfiguration["id"] = *r.Id
111117
}

oci/core_instance_configuration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ func TestCoreInstanceConfigurationResource_basic(t *testing.T) {
354354

355355
resource.TestCheckResourceAttr(datasourceName, "instance_configurations.#", "1"),
356356
resource.TestCheckResourceAttr(datasourceName, "instance_configurations.0.compartment_id", compartmentId),
357+
resource.TestCheckResourceAttr(datasourceName, "instance_configurations.0.defined_tags.%", "1"),
357358
resource.TestCheckResourceAttr(datasourceName, "instance_configurations.0.display_name", "displayName2"),
359+
resource.TestCheckResourceAttr(datasourceName, "instance_configurations.0.freeform_tags.%", "1"),
358360
resource.TestCheckResourceAttrSet(datasourceName, "instance_configurations.0.id"),
359361
resource.TestCheckResourceAttrSet(datasourceName, "instance_configurations.0.time_created"),
360362
),

oci/core_instance_configurations_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,16 @@ func (s *CoreInstanceConfigurationsDataSourceCrud) SetData() error {
8989
"compartment_id": *r.CompartmentId,
9090
}
9191

92+
if r.DefinedTags != nil {
93+
instanceConfiguration["defined_tags"] = definedTagsToMap(r.DefinedTags)
94+
}
95+
9296
if r.DisplayName != nil {
9397
instanceConfiguration["display_name"] = *r.DisplayName
9498
}
9599

100+
instanceConfiguration["freeform_tags"] = r.FreeformTags
101+
96102
if r.Id != nil {
97103
instanceConfiguration["id"] = *r.Id
98104
}

oci/core_instance_pool_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ func TestCoreInstancePoolResource_basic(t *testing.T) {
294294

295295
resource.TestCheckResourceAttr(datasourceName, "instance_pools.#", "1"),
296296
resource.TestCheckResourceAttr(datasourceName, "instance_pools.0.compartment_id", compartmentId),
297+
resource.TestCheckResourceAttr(datasourceName, "instance_pools.0.defined_tags.%", "1"),
297298
resource.TestCheckResourceAttr(datasourceName, "instance_pools.0.display_name", "displayName2"),
299+
resource.TestCheckResourceAttr(datasourceName, "instance_pools.0.freeform_tags.%", "1"),
298300
resource.TestCheckResourceAttrSet(datasourceName, "instance_pools.0.id"),
299301
resource.TestCheckResourceAttrSet(datasourceName, "instance_pools.0.instance_configuration_id"),
300302
resource.TestCheckResourceAttr(datasourceName, "instance_pools.0.size", "3"),

oci/core_instance_pools_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@ func (s *CoreInstancePoolsDataSourceCrud) SetData() error {
106106
"compartment_id": *r.CompartmentId,
107107
}
108108

109+
if r.DefinedTags != nil {
110+
instancePool["defined_tags"] = definedTagsToMap(r.DefinedTags)
111+
}
112+
109113
if r.DisplayName != nil {
110114
instancePool["display_name"] = *r.DisplayName
111115
}
112116

117+
instancePool["freeform_tags"] = r.FreeformTags
118+
113119
if r.Id != nil {
114120
instancePool["id"] = *r.Id
115121
}

website/docs/d/autoscaling_auto_scaling_configuration.html.markdown

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: |-
99
# Data Source: oci_autoscaling_auto_scaling_configuration
1010
This data source provides details about a specific Auto Scaling Configuration resource in Oracle Cloud Infrastructure Autoscaling service.
1111

12-
Get AutoScalingConfiguration
12+
Gets information about the specified autoscaling configuration.
1313

1414
## Example Usage
1515

@@ -24,42 +24,44 @@ data "oci_autoscaling_auto_scaling_configuration" "test_auto_scaling_configurati
2424

2525
The following arguments are supported:
2626

27-
* `auto_scaling_configuration_id` - (Required) The OCID of the auto scaling configuration.
27+
* `auto_scaling_configuration_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the autoscaling configuration.
2828

2929

3030
## Attributes Reference
3131

3232
The following attributes are exported:
3333

3434
* `auto_scaling_resources` -
35-
* `id` - The OCID of resource that the AutoScalingConfiguration will manage.
36-
* `type` - Indicates type of derived class
37-
* `compartment_id` - The OCID of the compartment containing the AutoScalingConfiguration.
38-
* `cool_down_in_seconds` - The minimum period of time between scaling actions. The default is 300 seconds.
35+
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the resource that is managed by the autoscaling configuration.
36+
* `type` - The type of resource.
37+
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the autoscaling configuration.
38+
* `cool_down_in_seconds` - The minimum period of time to wait between scaling actions. The cooldown period gives the system time to stabilize before rescaling. The minimum value is 300 seconds, which is also the default.
3939
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
40-
* `display_name` - A user-friendly name for the AutoScalingConfiguration. Does not have to be unique, and it's changeable. Avoid entering confidential information.
40+
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
4141
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
42-
* `id` - The OCID of the AutoScalingConfiguration
43-
* `is_enabled` - If the AutoScalingConfiguration is enabled
44-
* `policies` - AutoScalingConfiguration policy definitions
45-
* `capacity` - The capacity requirements of the Policy
46-
* `initial` - The initial size of the pool
47-
* `max` - The maximum size the pool is allowed to increase to
48-
* `min` - The minimum size the pool is allowed to decrease to
49-
* `display_name` - A user-friendly name for the Policy. Does not have to be unique, and it's changeable. Avoid entering confidential information.
50-
* `id` - The ID of the policy that is assigned after creation
51-
* `policy_type` - Indicates type of Policy
42+
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the autoscaling configuration.
43+
* `is_enabled` - Whether the autoscaling configuration is enabled.
44+
* `policies` - Autoscaling policy definitions for the autoscaling configuration. An autoscaling policy defines the criteria that trigger autoscaling actions and the actions to take.
45+
46+
Each autoscaling configuration can have one autoscaling policy.
47+
* `capacity` - The capacity requirements of the autoscaling policy.
48+
* `initial` - The initial number of instances to launch in the instance pool immediately after autoscaling is enabled. After autoscaling retrieves performance metrics, the number of instances is automatically adjusted from this initial number to a number that is based on the limits that you set.
49+
* `max` - The maximum number of instances the instance pool is allowed to increase to (scale out).
50+
* `min` - The minimum number of instances the instance pool is allowed to decrease to (scale in).
51+
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
52+
* `id` - The ID of the autoscaling policy that is assigned after creation.
53+
* `policy_type` - The type of autoscaling policy.
5254
* `rules` -
5355
* `action` -
54-
* `type` - Action type to take
55-
* `value` -
56-
* `display_name` - A user-friendly name for the AutoScalingConfiguration condition details. Does not have to be unique, and it's changeable. Avoid entering confidential information.
57-
* `id` - Id of the condition that is assigned after creation
56+
* `type` - The type of action to take.
57+
* `value` - To scale out (increase the number of instances), provide a positive value. To scale in (decrease the number of instances), provide a negative value.
58+
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
59+
* `id` - ID of the condition that is assigned after creation.
5860
* `metric` -
5961
* `metric_type` -
6062
* `threshold` -
61-
* `operator` - Support for the following operators GT - Greater than GTE - Greater than equal to LT - Less than LTE - Less than equal to
63+
* `operator` - The comparison operator to use. Options are greater than (`GT`), greater than or equal to (`GTE`), less than (`LT`), and less than or equal to (`LTE`).
6264
* `value` -
63-
* `time_created` - The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
64-
* `time_created` - The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
65+
* `time_created` - The date and time the autoscaling configuration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
66+
* `time_created` - The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
6567

website/docs/d/autoscaling_auto_scaling_configurations.html.markdown

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: |-
99
# Data Source: oci_autoscaling_auto_scaling_configurations
1010
This data source provides the list of Auto Scaling Configurations in Oracle Cloud Infrastructure Autoscaling service.
1111

12-
Lists AutoScalingConfigurations in the specific compartment.
12+
Lists autoscaling configurations in the specifed compartment.
1313

1414

1515
## Example Usage
@@ -43,15 +43,14 @@ The following attributes are exported:
4343
The following attributes are exported:
4444

4545
* `auto_scaling_resources` -
46-
* `id` - The OCID of resource that the AutoScalingConfiguration will manage.
47-
* `type` - Indicates type of derived class
48-
* `compartment_id` - The OCID of the compartment containing the AutoScalingConfiguration.
49-
* `cool_down_in_seconds` - The minimum period of time between scaling actions. The default is 300 seconds.
46+
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the resource that is managed by the autoscaling configuration.
47+
* `type` - The type of resource.
48+
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the autoscaling configuration.
49+
* `cool_down_in_seconds` - The minimum period of time to wait between scaling actions. The cooldown period gives the system time to stabilize before rescaling. The minimum value is 300 seconds, which is also the default.
5050
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
51-
* `display_name` - A user-friendly name for the AutoScalingConfiguration. Does not have to be unique, and it's changeable. Avoid entering confidential information.
51+
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
5252
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
53-
* `id` - The OCID of the AutoScalingConfiguration
54-
* `is_enabled` - If the AutoScalingConfiguration is enabled
55-
* `policies` - AutoScalingConfiguration policy definitions
56-
* `time_created` - The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
57-
53+
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the autoscaling configuration.
54+
* `is_enabled` - Whether the autoscaling configuration is enabled.
55+
* `policies` - Autoscaling policy definitions for the autoscaling configuration. An autoscaling policy defines the criteria that trigger autoscaling actions and the actions to take.
56+
* `time_created` - The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`

0 commit comments

Comments
 (0)