-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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! |
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?
website/docs/r/resource_group_cost_management_export.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/subscription_cost_management_export.html.markdown
Outdated
Show resolved
Hide resolved
internal/services/costmanagement/export_billing_account_resource_test.go
Outdated
Show resolved
Hide resolved
internal/services/costmanagement/export_billing_account_resource_test.go
Outdated
Show resolved
Hide resolved
internal/services/costmanagement/export_resource_group_resource_test.go
Outdated
Show resolved
Hide resolved
Hey there,
In other words, does this mean that the tests that already exist should in fact be left totally unmodified (currently we add Or is it good to test the optional fields functioning properly in the update flow? |
Sorry, both update and requiresImport test case mutate the new optional fields. |
3d1a83d
to
86c9289
Compare
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 making those changes @joshk0. Unfortunately now none of the test configs have partition_data_enabled
so we're unable to test this change. As mentioned in my previous comment, we cannot add this property to the basic
configuration since it's optional, and it cannot be added to the update
configuration since it would trigger a ForceNew
. Can you please add a complete
test configuration that include this property?
Sure I was just asking a question and doing things that did not require an answer to that question (which you didn't directly answer, but did indirectly through hints in your answer.) I will add the test case now. |
86c9289
to
578cc5f
Compare
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.
Apologies @joshk0! I must have overlooked the question you left about the test when I did my re-review.
Thank you for adding the complete
test configuration. I've kicked off the tests but we have some test failures:
------- Stdout: -------
=== RUN TestAccResourceGroupCostManagementExport_complete
=== PAUSE TestAccResourceGroupCostManagementExport_complete
=== CONT TestAccResourceGroupCostManagementExport_complete
testcase.go:121: Step 1/2 error: Error running apply: exit status 1
Error: creating Scoped Export (Scope: "/subscriptions/*******/resourceGroups/acctestRG-cm-240801080753627897"
Export Name: "accrg240801080753627897"): unexpected status 400 (400 Bad Request) with error: BadRequest: Request properties validation failed: Invalid deliveryInfo destination rootFolderPath; value cannot begin with a forward slash
with azurerm_resource_group_cost_management_export.test,
on terraform_plugin_test.tf line 47, in resource "azurerm_resource_group_cost_management_export" "test":
47: resource "azurerm_resource_group_cost_management_export" "test" {
creating Scoped Export (Scope:
"/subscriptions/*******/resourceGroups/acctestRG-cm-240801080753627897"
Export Name: "accrg240801080753627897"): unexpected status 400 (400 Bad
Request) with error: BadRequest: Request properties validation failed:
Invalid deliveryInfo destination rootFolderPath; value cannot begin with a
forward slash
--- FAIL: TestAccResourceGroupCostManagementExport_complete (132.73s)
FAIL
------- Stdout: -------
=== RUN TestAccSubscriptionCostManagementExport_update
=== PAUSE TestAccSubscriptionCostManagementExport_update
=== CONT TestAccSubscriptionCostManagementExport_update
testcase.go:121: Step 1/6 error: Error running apply: exit status 1
Error: creating Scoped Export (Scope: "/subscriptions/*******"
Export Name: "accs240801080753607043"): unexpected status 400 (400 Bad Request) with error: BadRequest: Request properties validation failed: Export data version: is not supported.
with azurerm_subscription_cost_management_export.test,
on terraform_plugin_test.tf line 52, in resource "azurerm_subscription_cost_management_export" "test":
52: resource "azurerm_subscription_cost_management_export" "test" {
creating Scoped Export (Scope:
"/subscriptions/*******"
Export Name: "accs240801080753607043"): unexpected status 400 (400 Bad
Request) with error: BadRequest: Request properties validation failed: Export
data version: is not supported.
--- FAIL: TestAccSubscriptionCostManagementExport_update (157.92s)
FAIL
Hi @stephybun , just pushed some fixes that I think will work? If you could kick off the flows when you have a chance. |
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.
@joshk0 unfortunately we're still getting the same failures:
=== CONT TestAccResourceGroupCostManagementExport_basic
testcase.go:121: Step 1/2 error: Error running apply: exit status 1
Error: creating Scoped Export (Scope: "/subscriptions/*******/resourceGroups/acctestRG-cm-240807120359725390"
Export Name: "accrg240807120359725390"): unexpected status 400 (400 Bad Request) with error: BadRequest: Request properties validation failed: Export data version: is not supported.
…bled` and `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_enabled` maps to `export.partition_data`. Defaults to false.
6ad9b7d
to
286c206
Compare
@stephybun one more time please |
I had to vendor so one more time again sorry @stephybun |
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.
Still receiving the same error:
Error: creating Scoped Export (Scope: "/subscriptions/*******"
Export Name: "accs240808092720759225"): unexpected status 400 (400 Bad Request) with error: BadRequest: Request properties validation failed: Export data version: is not supported.
I currently don't have the capacity to dig deeper into this, best guess based on the error message being returned by the API
- Property isn't properly supported by the API, I had a brief look in the portal and I don't see an option for data version
- Value being used for data version isn't valid/supported
Don't worry about trying to figure it out, I will just keep banging on it here just need the PRs to run |
@stephybun |
BTW, this is the failure from the unit-test phase:
|
Yes, this is something you can only do via the console today.
Perhaps it has to be mandatory. The reality is that in the portal you get to choose among a variety of different versions based on the export you are making. |
@@ -39,6 +39,25 @@ func TestAccBillingAccountCostManagementExport_basic(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccBillingAccountCostManagementExport_complete(t *testing.T) { | |||
if os.Getenv("ARM_BILLING_ACCOUNT") == "" { |
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.
nit: Subscriptions are supported as well
|
||
"data_version": { | ||
Type: pluginsdk.TypeString, | ||
Optional: 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.
I don't think this should be optional. I'm pretty sure it's required unless the API is defaulting.
@@ -6,10 +6,10 @@ package client | |||
import ( | |||
"fmt" | |||
|
|||
"github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" |
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.
I would probably keep the old version as well. I believe there are some gaps between what's supported in each version.
@jojohpm would know more.
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.
If we have a provision to keep 2 versions, then we could keep both.
2021-10-01 = Exports v1. Legacy exports.
2023-07-01-preview = Exports v2. The new one with file partitioning, compression, file format, newer datasets etc... This is going to be the default experience going forward.
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.
Added the comment.
@@ -6,10 +6,10 @@ package client | |||
import ( | |||
"fmt" | |||
|
|||
"github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" |
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.
If we have a provision to keep 2 versions, then we could keep both.
2021-10-01 = Exports v1. Legacy exports.
2023-07-01-preview = Exports v2. The new one with file partitioning, compression, file format, newer datasets etc... This is going to be the default experience going forward.
Hello @joshk0 , could you fix the merge conflicts? |
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.