azurermSubscriptionCostManagementExport
Manages a Cost Management Export for a Subscription.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
this,
"example_1",
{
account_replication_type: "LRS",
account_tier: "Standard",
location: azurermResourceGroupExample.location,
name: "example",
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermStorageContainerExample =
new azurerm.storageContainer.StorageContainer(this, "example_2", {
name: "examplecontainer",
storage_account_name: azurermStorageAccountExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageContainerExample.overrideLogicalId("example");
const dataAzurermSubscriptionExample =
new azurerm.dataAzurermSubscription.DataAzurermSubscription(
this,
"example_3",
{}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermSubscriptionExample.overrideLogicalId("example");
const azurermSubscriptionCostManagementExportExample =
new azurerm.subscriptionCostManagementExport.SubscriptionCostManagementExport(
this,
"example_4",
{
export_data_options: [
{
time_frame: "WeekToDate",
type: "Usage",
},
],
export_data_storage_location: [
{
container_id: azurermStorageContainerExample.resourceManagerId,
root_folder_path: "/root/updated",
},
],
name: "example",
recurrence_period_end_date: "2020-09-18T00:00:00Z",
recurrence_period_start_date: "2020-08-18T00:00:00Z",
recurrence_type: "Monthly",
subscription_id: dataAzurermSubscriptionExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubscriptionCostManagementExportExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Cost Management Export. Changing this forces a new resource to be created. -
subscriptionId
- (Required) The id of the subscription on which to create an export. Changing this forces a new resource to be created. -
recurrenceType
- (Required) How often the requested information will be exported. Valid values includeannually
,daily
,monthly
,weekly
. -
recurrencePeriodStartDate
- (Required) The date the export will start capturing information. -
recurrencePeriodEndDate
- (Required) The date the export will stop capturing information. -
exportDataStorageLocation
- (Required) AexportDataStorageLocation
block as defined below. -
exportDataOptions
- (Required) AexportDataOptions
block as defined below. -
active
- (Optional) Is the cost management export active? Default istrue
.
A exportDataStorageLocation
block supports the following:
-
containerId
- (Required) The Resource Manager ID of the container where exports will be uploaded. Changing this forces a new resource to be created. -
rootFolderPath
- (Required) The path of the directory where exports will be uploaded. Changing this forces a new resource to be created.
\~> Note: The Resource Manager ID of a Storage Container is exposed via the resourceManagerId
attribute of the azurermStorageContainer
resource.
A exportDataOptions
block supports the following:
-
type
- (Required) The type of the query. Possible values areactualCost
,amortizedCost
andusage
. -
timeFrame
- (Required) The time frame for pulling data for the query. If custom, then a specific time period must be provided. Possible values include:weekToDate
,monthToDate
,billingMonthToDate
,theLastWeek
,theLastMonth
,theLastBillingMonth
,custom
.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Cost Management Export for this Subscription.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Subscription Cost Management Export.read
- (Defaults to 5 minutes) Used when retrieving the Subscription Cost Management Export.update
- (Defaults to 30 minutes) Used when updating the Subscription Cost Management Export.delete
- (Defaults to 30 minutes) Used when deleting the Subscription Cost Management Export.
Import
Subscription Cost Management Exports can be imported using the resourceId
, e.g.