-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fields to azurerm_*_cost_management_export
: partition_data
and export_data_options.data_version
#26219
base: main
Are you sure you want to change the base?
Conversation
azurerm_*_cost_management_export
: partition_data
and export_data_options.data_version
azurerm_*_cost_management_export
: partition_data
and export_data_options.data_version
Please let me know if I need to run the live Azure acceptance tests myself in order to proceed. |
f945c9a
to
6673a2e
Compare
Hello, is it possible to get a review for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the pr @joshk0 - for booleans we add _enabled to the end of them to mark them as bools. once that change is made i think this is good to go
website/docs/r/billing_account_cost_management_export.html.markdown
Outdated
Show resolved
Hide resolved
@katbyte, done. Please have a look. Thank you! |
…d `export_data_options.version` `export_data_options.version` maps to `export.definition.dataset.configuration.dataVersion` No default. Versions can proliferate and even though we can collect a large list of possible versions it's better to leave it free form. `partition_data` maps to `export.partition_data`. Defaults to false.
2ec11a7
to
e60895b
Compare
I have rebased the branch to include the new go-azure-sdk. maybe it will work now? Could someone please approve the workflows? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @joshk0. There are some minor things that need fixing up to bring this more in-line with other resources in the provider.
Most resources have a basic
and a complete
test configuration, where the basic
only includes properties that are Required
and the complete
configuration includes properties that are Optional
. I see that we're missing a complete
test config here, do you think you could look into adding that so we can validate the partition_data_enabled
property?
"partition_data_enabled": { | ||
Type: pluginsdk.TypeBool, | ||
Optional: true, | ||
Required: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to specify false
for Required
since it's implied by Optional
being set to true
Required: false, |
@@ -100,10 +108,17 @@ func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsd | |||
string(exports.TimeframeTypeTheLastMonth), | |||
string(exports.TimeframeTypeWeekToDate), | |||
string(exports.TimeframeTypeMonthToDate), | |||
string(exports.TimeframeTypeMonthToDate), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already support this value above so this would be a duplicate
string(exports.TimeframeTypeMonthToDate), |
"data_version": { | ||
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
Required: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required: false, |
// TODO Use value from SDK after https://github.com/Azure/azure-rest-api-specs/issues/23707 is fixed | ||
"TheLast7Days", | ||
}, false), | ||
}, | ||
|
||
"data_version": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some validation we could add for this property? Even just a validation.StringIsNotEmpty
?
if partitionData := props.PartitionData; partitionData != nil { | ||
metadata.ResourceData.Set("partition_data_enabled", *partitionData) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use pointer.From
here to do the nil-check
if partitionData := props.PartitionData; partitionData != nil { | |
metadata.ResourceData.Set("partition_data_enabled", *partitionData) | |
} | |
metadata.ResourceData.Set("partition_data_enabled", pointer.From(props.PartitionData)) |
@@ -59,6 +61,8 @@ The following arguments are supported: | |||
|
|||
* `resource_group_id` - (Required) The id of the resource group on which to create an export. Changing this forces a new resource to be created. | |||
|
|||
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. | |
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. Changing this forces a new resource to be created. Defaults to `false`. |
@@ -61,6 +63,8 @@ The following arguments are supported: | |||
|
|||
* `subscription_id` - (Required) The id of the subscription on which to create an export. Changing this forces a new resource to be created. | |||
|
|||
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. | |
* `partition_data_enabled` - (Optional) Whether data will be partitioned into smaller files to facilitate consumption. Changing this forces a new resource to be created. Defaults to `false`. |
@@ -143,15 +143,17 @@ resource "azurerm_billing_account_cost_management_export" "test" { | |||
recurrence_type = "Monthly" | |||
recurrence_period_start_date = "%sT00:00:00Z" | |||
recurrence_period_end_date = "%sT00:00:00Z" | |||
partition_data_enabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partition_data_enabled = true |
export_data_storage_location { | ||
container_id = azurerm_storage_container.test.resource_manager_id | ||
root_folder_path = "/root" | ||
} | ||
export_data_options { | ||
type = "Usage" | ||
time_frame = "TheLastMonth" | ||
data_version = "2019-11-01" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_version = "2019-11-01" |
@@ -171,14 +173,16 @@ resource "azurerm_resource_group_cost_management_export" "test" { | |||
recurrence_type = "Monthly" | |||
recurrence_period_start_date = "%sT00:00:00Z" | |||
recurrence_period_end_date = "%sT00:00:00Z" | |||
partition_data_enabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would trigger the recreation of the resource so this needs to be removed from the update
test config.
partition_data_enabled = true |
Community Note
Description
Add fields to
azurerm_*_cost_management_export
:partition_data
andexport_data_options.version
.export_data_options.version
maps toexport.definition.dataset.configuration.dataVersion
- No default. Versions can proliferate and even though we can collect a large list of possible versions it's better to leave it free form.partition_data
maps toexport.partition_data
. Defaults to false.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_*_cost_management_export
- support for thepartition_data
andexport_data_options.data_version
properties [Support for partition_data in azurerm_subscription_cost_management_export #23747]This is a (please select all that apply):
Related Issue(s)
Fixes #23747
Note
If this PR changes meaningfully during the course of review please update the title and description as required.