Skip to content

Commit

Permalink
FOPTS-3024 - New Budget vs Actual Spend report policy (#1778)
Browse files Browse the repository at this point in the history
* Add files for new budget vs actual spend report policy

* Update new budget vs actual spend policy; Deprecate the legacy policy

* Update the changelog

* Update overbudget zero value

* Add note on budget report link to clarify unfiltered data

* Enable PT for automated permissions

* Change template to support startAt and endAt as query parameters

* Fix descriptions and README.md

* Fix endAt date

* Remove blank lines
  • Loading branch information
night-codes authored Mar 1, 2024
1 parent 27e5786 commit 2784a87
Show file tree
Hide file tree
Showing 9 changed files with 617 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cost/budget_v_actual/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## v2.1

- Deprecated: This policy is no longer being updated.

## v2.0

- Deprecated `auth_rs` authentication (type: `rightscale`) and replaced with `auth_flexera` (type: `oauth2`). This is a breaking change which requires a Credential for `auth_flexera` [`provider=flexera`] before the policy can be applied. Please see docs for setting up [Provider-Specific Credentials](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm)
- Deprecated `auth_rs` authentication (type: `rightscale`) and replaced with `auth_flexera` (type: `oauth2`). This is a breaking change which requires a Credential for `auth_flexera` [`provider=flexera`] before the policy can be applied. Please see docs for setting up [Provider-Specific Credentials](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm)
- Replaced references `github.com/rightscale/policy_templates` and `github.com/flexera/policy_templates` with `github.com/flexera-public/policy_templates`

## v1.6
Expand Down
8 changes: 6 additions & 2 deletions cost/budget_v_actual/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Monthly Actual v. Budgeted Spend Report

## Deprecated

This policy is no longer being updated.

## What it does

This policy allows you to set up scheduled reports that will provide monthly actual v. budgeted cloud cost across all resources in the Billing Center(s) you specify, delivered to any email addresses you specify.
Expand Down Expand Up @@ -36,8 +40,8 @@ There are four cost metrics to choose from.
This policy has the following input parameters required when launching the policy.

- *Email list* - Email addresses of the recipients you wish to notify
- *Billing Center List* - List of top level Billing Center names you want to report on. Names must be exactly as shown in Optima. Leave the field blank to report on all top level Billing Centers.
- *Cost Metric* - See Cost Metrics above for details on selection.
- *Billing Center List* - List of top level Billing Center names you want to report on. Names must be exactly as shown in Optima. Leave the field blank to report on all top level Billing Centers.
- *Cost Metric* - See Cost Metrics above for details on selection.
- *January Budgeted Cost* - January budgeted cost for corresponding Billing Center
- *February Budgeted Cost* - February budgeted cost for corresponding Billing Center
- *March Budgeted Cost* - March budgeted cost for corresponding Billing Center
Expand Down
9 changes: 5 additions & 4 deletions cost/budget_v_actual/monthly_budget_v_actual.pt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name "Monthly Actual v. Budgeted Spend Report"
rs_pt_ver 20180301
type "policy"
short_description "This policy allows you to set up scheduled reports that will provide monthly actual v. budgeted cloud cost across all resources in the Billing Center(s) you specify, delivered to any email addresses you specify. See the [README](https://github.com/flexera-public/policy_templates/tree/master/cost/budget_v_actual) and [docs.flexera.com/flexera/EN/Automation](https://docs.flexera.com/flexera/EN/Automation/AutomationGS.htm) to learn more."
short_description "**Deprecated: This policy is no longer being updated.** This policy allows you to set up scheduled reports that will provide monthly actual v. budgeted cloud cost across all resources in the Billing Center(s) you specify, delivered to any email addresses you specify. See the [README](https://github.com/flexera-public/policy_templates/tree/master/cost/budget_v_actual) and [docs.flexera.com/flexera/EN/Automation](https://docs.flexera.com/flexera/EN/Automation/AutomationGS.htm) to learn more."
severity "low"
category "Cost"
tenancy "single"
default_frequency "daily"
info(
version: "2.0",
version: "2.1",
provider: "Flexera Optima",
service: "",
policy_set: ""
policy_set: "",
publish: "false"
)

parameter "param_email" do
Expand Down Expand Up @@ -229,7 +230,7 @@ script "js_current_month_cost_request", type: "javascript" do
}
var body = {
"dimensions":[]
"dimensions":[],
"granularity":"day",
"start_at": start_at ,
"end_at": end_at
Expand Down
5 changes: 5 additions & 0 deletions cost/budget_v_actual_spend_report/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v2.0

- initial release
32 changes: 32 additions & 0 deletions cost/budget_v_actual_spend_report/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Budget vs Actual Spend Report

## What it does

This policy generates an email report comparing actual spending to budgeted values. It utilizes the Flexera Budget API to gather details and sends the report via email, eliminating the need for stakeholders to log in to Flexera One for report access.

## Prerequisites

This policy requires appropriate [Credentials](https://docs.flexera.com/flexera/EN/Automation/ManagingCredentialsExternal.htm) for authentication. Ensure a Flexera Credential is registered, compatible with this policy.

- [**Flexera Credential**](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) (_provider=flexera_) which has the following roles:
- `optima:budget:index`
- `optima:budget:report`
- `optima:billing_center:show`

Refer to the [Provider-Specific Credentials](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) page for detailed instructions on setting up Credentials.

## Functional Details

- Chart templates are updated for improved configuration adaptability.
- Various minor enhancements and bug fixes contribute to improved stability and performance.

## Input Parameters

- _Budget Name or ID_: The name or ID of the target Budget.
- _Filter Group By Dimensions_: Filter by dimension=value pairs (e.g., 'Cloud Vendor=AWS'). Multiple values for the same dimension can be supplied as coma-separated list.
- _Unbudgeted Spend_: Parameter to include or exclude unbudgeted funds in the calculation.
- _Email Addresses_: A list of email addresses to notify.

## Cost

This Policy Template does not incur any cloud costs.
Loading

0 comments on commit 2784a87

Please sign in to comment.