Skip to content

Commit b288f18

Browse files
Support for Charge for Custom Images in core resource
1 parent 1398b23 commit b288f18

File tree

8 files changed

+22
-0
lines changed

8 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Support for E3 Flex Notebooks added to `datascience`
1212
- Support for Non-Rolling patch mode added to `database_maintenance_run_resource`
1313
- Support for update compartment for `oci_core_default_security_list`, `oci_core_default_dhcp_options`, `oci_core_default_route_table`
14+
- Support for Charge for Custom Images in core resource
1415

1516
## 4.27.0 (May 19, 2021)
1617

oci/core_image_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ func (s *CoreImageDataSourceCrud) SetData() error {
7878
s.D.Set("base_image_id", *s.Res.BaseImageId)
7979
}
8080

81+
if s.Res.BillableSizeInGBs != nil {
82+
s.D.Set("billable_size_in_gbs", strconv.FormatInt(*s.Res.BillableSizeInGBs, 10))
83+
}
84+
8185
if s.Res.CompartmentId != nil {
8286
s.D.Set("compartment_id", *s.Res.CompartmentId)
8387
}

oci/core_image_resource.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ func CoreImageResource() *schema.Resource {
161161
Type: schema.TypeString,
162162
Computed: true,
163163
},
164+
"billable_size_in_gbs": {
165+
Type: schema.TypeString,
166+
Computed: true,
167+
},
164168
"create_image_allowed": {
165169
Type: schema.TypeBool,
166170
Computed: true,
@@ -453,6 +457,10 @@ func (s *CoreImageResourceCrud) SetData() error {
453457
s.D.Set("base_image_id", *s.Res.BaseImageId)
454458
}
455459

460+
if s.Res.BillableSizeInGBs != nil {
461+
s.D.Set("billable_size_in_gbs", strconv.FormatInt(*s.Res.BillableSizeInGBs, 10))
462+
}
463+
456464
if s.Res.CompartmentId != nil {
457465
s.D.Set("compartment_id", *s.Res.CompartmentId)
458466
}

oci/core_image_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ func TestCoreImageResource_basic(t *testing.T) {
212212
resource.TestCheckResourceAttr(datasourceName, "images.#", "1"),
213213
resource.TestCheckResourceAttr(datasourceName, "images.0.agent_features.#", "0"),
214214
resource.TestCheckResourceAttrSet(datasourceName, "images.0.base_image_id"),
215+
resource.TestCheckResourceAttrSet(datasourceName, "images.0.billable_size_in_gbs"),
215216
resource.TestCheckResourceAttr(datasourceName, "images.0.compartment_id", compartmentId),
216217
resource.TestCheckResourceAttrSet(datasourceName, "images.0.create_image_allowed"),
217218
resource.TestCheckResourceAttr(datasourceName, "images.0.defined_tags.%", "1"),
@@ -237,6 +238,7 @@ func TestCoreImageResource_basic(t *testing.T) {
237238

238239
resource.TestCheckResourceAttr(singularDatasourceName, "agent_features.#", "0"),
239240
resource.TestCheckResourceAttrSet(singularDatasourceName, "base_image_id"),
241+
resource.TestCheckResourceAttrSet(singularDatasourceName, "billable_size_in_gbs"),
240242
resource.TestCheckResourceAttr(singularDatasourceName, "compartment_id", compartmentId),
241243
resource.TestCheckResourceAttrSet(singularDatasourceName, "create_image_allowed"),
242244
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "1"),

oci/core_images_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ func (s *CoreImagesDataSourceCrud) SetData() error {
177177
image["base_image_id"] = *r.BaseImageId
178178
}
179179

180+
if r.BillableSizeInGBs != nil {
181+
image["billable_size_in_gbs"] = strconv.FormatInt(*r.BillableSizeInGBs, 10)
182+
}
183+
180184
if r.CreateImageAllowed != nil {
181185
image["create_image_allowed"] = *r.CreateImageAllowed
182186
}

website/docs/d/core_image.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following attributes are exported:
3636
* `is_management_supported` - Whether Oracle Cloud Agent can run all the available management plugins.
3737
* `is_monitoring_supported` - Whether Oracle Cloud Agent can gather performance metrics and monitor the instance.
3838
* `base_image_id` - The OCID of the image originally used to launch the instance.
39+
* `billable_size_in_gbs` - The size of the internal storage for this image that is subject to billing (1 GB = 1,073,741,824 bytes). Example: `100`
3940
* `compartment_id` - The OCID of the compartment containing the instance you want to use as the basis for the image.
4041
* `create_image_allowed` - Whether instances launched with this image can be used to create new images. For example, you cannot create an image of an Oracle Database instance. Example: `true`
4142
* `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"}`

website/docs/d/core_images.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The following attributes are exported:
6565
* `is_management_supported` - Whether Oracle Cloud Agent can run all the available management plugins.
6666
* `is_monitoring_supported` - Whether Oracle Cloud Agent can gather performance metrics and monitor the instance.
6767
* `base_image_id` - The OCID of the image originally used to launch the instance.
68+
* `billable_size_in_gbs` - The size of the internal storage for this image that is subject to billing (1 GB = 1,073,741,824 bytes). Example: `100`
6869
* `compartment_id` - The OCID of the compartment containing the instance you want to use as the basis for the image.
6970
* `create_image_allowed` - Whether instances launched with this image can be used to create new images. For example, you cannot create an image of an Oracle Database instance. Example: `true`
7071
* `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"}`

website/docs/r/core_image.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ The following attributes are exported:
140140
* `is_management_supported` - Whether Oracle Cloud Agent can run all the available management plugins.
141141
* `is_monitoring_supported` - Whether Oracle Cloud Agent can gather performance metrics and monitor the instance.
142142
* `base_image_id` - The OCID of the image originally used to launch the instance.
143+
* `billable_size_in_gbs` - The size of the internal storage for this image that is subject to billing (1 GB = 1,073,741,824 bytes). Example: `100`
143144
* `compartment_id` - The OCID of the compartment containing the instance you want to use as the basis for the image.
144145
* `create_image_allowed` - Whether instances launched with this image can be used to create new images. For example, you cannot create an image of an Oracle Database instance. Example: `true`
145146
* `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"}`

0 commit comments

Comments
 (0)