oci_metering_computation_usage_carbon_emission
This resource provides the Usage Carbon Emission resource in Oracle Cloud Infrastructure Metering Computation service. Api doc link for the resource: https://docs.oracle.com/iaas/api/#/en/usage/latest/UsageCarbonEmission
Example terraform configs related to the resource : https://github.com/oracle/terraform-provider-oci/tree/master/examples/metering_computation
Returns carbon emission usage for the given account.
Example Usage
resource "oci_metering_computation_usage_carbon_emission" "test_usage_carbon_emission" {
	#Required
	tenant_id = oci_metering_computation_tenant.test_tenant.id
	time_usage_ended = var.usage_carbon_emission_time_usage_ended
	time_usage_started = var.usage_carbon_emission_time_usage_started
	#Optional
	compartment_depth = var.usage_carbon_emission_compartment_depth
	emission_calculation_method = var.usage_carbon_emission_emission_calculation_method
	emission_type = var.usage_carbon_emission_emission_type
	granularity = var.usage_carbon_emission_granularity
	group_by = var.usage_carbon_emission_group_by
	group_by_tag {
		#Optional
		key = var.usage_carbon_emission_group_by_tag_key
		namespace = var.usage_carbon_emission_group_by_tag_namespace
		value = var.usage_carbon_emission_group_by_tag_value
	}
	is_aggregate_by_time = var.usage_carbon_emission_is_aggregate_by_time
	usage_carbon_emission_filter = var.usage_carbon_emission_usage_carbon_emission_filter
}
Argument Reference
The following arguments are supported:
- compartment_depth- (Optional) The compartment depth level.
- emission_calculation_method- (Optional) Specifies the method used for emission calculation, such as POWER_BASED or SPEND_BASED
- emission_type- (Optional) Specifies the type of emission, such as MARKET_BASED or LOCATION_BASED.
- granularity- (Optional) The carbon emission granularity. DAILY - Daily data aggregation. MONTHLY - Monthly data aggregation.
- group_by- (Optional) Aggregate the result by. For example:- ["tagNamespace", "tagKey", "tagValue", "service", "skuName", "skuPartNumber", "unit", "compartmentName", "compartmentPath", "compartmentId", "platform", "region", "logicalAd", "resourceId", "resourceName", "tenantId", "tenantName", "subscriptionId"]
- group_by_tag- (Optional) GroupBy a specific tagKey. Provide the tagNamespace and tagKey in the tag object. Only supports one tag in the list. For example:- [{"namespace":"oracle", "key":"createdBy"]- key- (Optional) The tag key.
- namespace- (Optional) The tag namespace.
- value- (Optional) The tag value.
 
- is_aggregate_by_time- (Optional) Specifies whether aggregated by time. If isAggregateByTime is true, all carbon emissions usage over the query time period are summed.
- tenant_id- (Required) Tenant ID.
- time_usage_ended- (Required) The usage end time.
- time_usage_started- (Required) The usage start time.
- usage_carbon_emission_filter- (Optional) The filter object for query usage.
** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values
Attributes Reference
The following attributes are exported:
- group_by- Specifies what to aggregate the result by.
- items- A list of carbon emission usage items.- ad- The availability domain of the usage.
- compartment_id- The compartment OCID.
- compartment_name- The compartment name.
- compartment_path- The compartment path, starting from root.
- computed_carbon_emission- The carbon emission usage in MTCO2 units.
- emission_calculation_method- Specifies the approach for calculating carbon emissions, supports both SPEND_BASED (based on expenditure data) and POWER_BASED (based on power consumption, newly introduced in the metering pipeline)
- emission_type- The emission type, such as MARKET_BASED or LOCATION_BASED.
- platform- Platform for the cost.
- region- The region of the usage.
- resource_id- The resource OCID that is incurring the cost.
- resource_name- The resource name that is incurring the cost.
- service- The service name that is incurring the cost.
- sku_name- The SKU friendly name.
- sku_part_number- The SKU part number.
- subscription_id- The subscription ID.
- tags- For grouping, a tag definition. For filtering, a definition and key.- key- The tag key.
- namespace- The tag namespace.
- value- The tag value.
 
- tenant_id- The tenancy OCID.
- tenant_name- The tenancy name.
- time_usage_ended- The usage end time.
- time_usage_started- The usage start time.
 
Timeouts
The timeouts block allows you to specify timeouts for certain operations:
	* create - (Defaults to 20 minutes), when creating the Usage Carbon Emission
	* update - (Defaults to 20 minutes), when updating the Usage Carbon Emission
	* delete - (Defaults to 20 minutes), when destroying the Usage Carbon Emission
Import
UsageCarbonEmissions can be imported using the id, e.g.
$ terraform import oci_metering_computation_usage_carbon_emission.test_usage_carbon_emission "id"