Skip to content
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

New Resource: azurerm_cost_management_export_resource_group #6131

Merged
merged 9 commits into from
Mar 18, 2020

Conversation

mbfrahry
Copy link
Member

--- PASS: TestAccAzureRMCostManagementExportResourceGroup_basic (147.15s)
--- PASS: TestAccAzureRMCostManagementExportResourceGroup_update (175.36s)

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from a couple comments LGTM 👍

Comment on lines 172 to 190
schedule := &costmanagement.ExportSchedule{
Recurrence: costmanagement.RecurrenceType(d.Get("recurrence_type").(string)),
RecurrencePeriod: &costmanagement.ExportRecurrencePeriod{
From: &date.Time{Time: from},
To: &date.Time{Time: to},
},
Status: status,
}

properties := &costmanagement.ExportProperties{
Schedule: schedule,
DeliveryInfo: expandExportDeliveryInfo(d.Get("delivery_info").([]interface{})),
Format: costmanagement.Csv,
Definition: expandExportQuery(d.Get("query").([]interface{})),
}

account := costmanagement.Export{
ExportProperties: properties,
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consolidate this to be consistent with other resources?

Suggested change
schedule := &costmanagement.ExportSchedule{
Recurrence: costmanagement.RecurrenceType(d.Get("recurrence_type").(string)),
RecurrencePeriod: &costmanagement.ExportRecurrencePeriod{
From: &date.Time{Time: from},
To: &date.Time{Time: to},
},
Status: status,
}
properties := &costmanagement.ExportProperties{
Schedule: schedule,
DeliveryInfo: expandExportDeliveryInfo(d.Get("delivery_info").([]interface{})),
Format: costmanagement.Csv,
Definition: expandExportQuery(d.Get("query").([]interface{})),
}
account := costmanagement.Export{
ExportProperties: properties,
}
schedule :=
account := costmanagement.Export{
ExportProperties: &costmanagement.ExportProperties{
Schedule: &costmanagement.ExportSchedule{
Recurrence: costmanagement.RecurrenceType(d.Get("recurrence_type").(string)),
RecurrencePeriod: &costmanagement.ExportRecurrencePeriod{
From: &date.Time{Time: from},
To: &date.Time{Time: to},
},
Status: status,
},
DeliveryInfo: expandExportDeliveryInfo(d.Get("delivery_info").([]interface{})),
Format: costmanagement.Csv,
Definition: expandExportQuery(d.Get("query").([]interface{})),
},
}


id := *resp.ID
// The ID is missing the prefix `/` which causes our uri parse to fail
if !strings.HasPrefix(*resp.ID, "/") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !strings.HasPrefix(*resp.ID, "/") {
if !strings.HasPrefix(id, "/") {

),
},
data.ImportStep(),
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a basic step here?

}

resource "azurerm_resource_group" "test" {
name = "acctestRG-cmerg-%d"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just put the service here

Suggested change
name = "acctestRG-cmerg-%d"
name = "acctestRG-cm-%d"

}

resource "azurerm_cost_management_export_resource_group" "test" {
name = "accrg%d"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use some capitals here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this time. It only accepts lower case

@mbfrahry mbfrahry merged commit 3065954 into master Mar 18, 2020
@mbfrahry mbfrahry deleted the f-cost-management-exports branch March 18, 2020 06:37
mbfrahry added a commit that referenced this pull request Mar 18, 2020
@ghost
Copy link

ghost commented Apr 17, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants