Skip to content

Commit

Permalink
POL-1383 New Policy: Google Missing Projects (#2745)
Browse files Browse the repository at this point in the history
* update

* fix

* update

* fix

* update

* fix

* update

* update

* update

* update

* update

* update

* update
  • Loading branch information
XOmniverse authored Oct 16, 2024
1 parent 2def36a commit 0b77130
Show file tree
Hide file tree
Showing 9 changed files with 429 additions and 11 deletions.
6 changes: 5 additions & 1 deletion automation/azure/azure_missing_subscriptions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## v0.1.1
## v0.1.2

- Minor code improvements to conform with current standards. Functionality unchanged.

## v0.1.1

- Removed outdated reference to 'Optima' from policy metadata. Functionality unchanged.

## v0.1

- initial release
6 changes: 1 addition & 5 deletions automation/azure/azure_missing_subscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@

## What It Does

This policy checks the stored Flexera CCO billing data for Azure from 3 days ago to obtain a list of Azure Subscriptions that we have billing data for and compares that to the list of Azure Subscriptions returned by the Azure Resource Manager API. An incident is raised and email sent containing any subscriptions present in Flexera CCO but not returned by the Azure Resource Manager API, as well as subscriptions returned by the Azure Resource Manager API but not present in Flexera CCO. The user can select which of those two reports they'd like to produce.
This policy template checks the stored Flexera CCO billing data for Azure from 3 days ago to obtain a list of Azure Subscriptions that we have billing data for and compares that to the list of Azure Subscriptions returned by the Azure Resource Manager API. An incident is raised and email sent containing any subscriptions present in Flexera CCO but not returned by the Azure Resource Manager API, as well as subscriptions returned by the Azure Resource Manager API but not present in Flexera CCO. The user can select which of those two reports they'd like to produce.

## Input Parameters

This policy has the following input parameters required when launching the policy.

- *Email Addresses* - Email addresses of the recipients you wish to notify when new incidents are created.
- *Azure Endpoint* - The endpoint to send Azure API requests to. Recommended to leave this at default unless using this policy with Azure China.
- *Report Selection* - Whether to report Subscriptions missing in the Azure API but present in CCO data, the opposite, or both.
- *Subscriptions Ignore List* - A list of Subscription IDs/names to never include in the results. Leave blank to not filter results

## Policy Actions

The following policy actions are taken on any resources found to be out of compliance.

- Send an email report

## Prerequisites
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ severity "low"
category "Cost"
default_frequency "weekly"
info(
version: "0.1.1",
version: "0.1.2",
provider: "Flexera",
service: "Optima",
service: "Cloud Cost Optimization",
policy_set: "Automation",
publish: "false"
)
Expand Down Expand Up @@ -201,7 +201,6 @@ datasource "ds_azure_subscriptions" do
path "/subscriptions/"
query "api-version","2020-01-01"
header "User-Agent", "RS Policies"
# Ignore status 400, 403, and 404 which can be returned in certain (legacy) types of Azure Subscriptions
ignore_status [400, 403, 404]
end
result do
Expand Down
5 changes: 5 additions & 0 deletions automation/google/google_missing_projects/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v0.1.0

- Initial release
35 changes: 35 additions & 0 deletions automation/google/google_missing_projects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Google Missing Projects

## What It Does

This policy template checks the stored Flexera CCO billing data for Google from 3 days ago to obtain a list of Google Projects that we have billing data for and compares that to the list of Google Projects returned by the Google Cloud Resource Manager API. An incident is raised and email sent containing any projects present in Flexera CCO but not returned by the Google Cloud Resource Manager API, as well as projects returned by the Google Cloud Resource Manager API but not present in Flexera CCO. The user can select which of those two reports they'd like to produce.

## Input Parameters

- *Email Addresses* - Email addresses of the recipients you wish to notify when new incidents are created.
- *Report Selection* - Whether to report Projects missing in the Google Cloud Resource Manager API but present in CCO data, the opposite, or both.
- *Projects Ignore List* - A list of Project IDs/names to never include in the results. Leave blank to not filter results.

## Policy Actions

- Send an email report

## Prerequisites

This Policy Template uses [Credentials](https://docs.flexera.com/flexera/EN/Automation/ManagingCredentialsExternal.htm) for authenticating to datasources -- in order to apply this policy you must have a Credential registered in the system that is compatible with this policy. If there are no Credentials listed when you apply the policy, please contact your Flexera Org Admin and ask them to register a Credential that is compatible with this policy. The information below should be consulted when creating the credential(s).

- [**Google Cloud Credential**](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm#automationadmin_4083446696_1121577) (*provider=gce*) which has the following:
- `resourcemanager.projects.get`

- [**Flexera Credential**](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) (*provider=flexera*) which has the following roles:
- `billing_center_viewer`

The [Provider-Specific Credentials](https://docs.flexera.com/flexera/EN/Automation/ProviderCredentials.htm) page in the docs has detailed instructions for setting up Credentials for the most common providers.

## Supported Clouds

- Google

## Cost

This policy template does not incur any cloud costs.
Loading

0 comments on commit 0b77130

Please sign in to comment.