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

chore: update module version usage #57

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ terraform.rc
# Other
.DS_Store
todo.md
.idea

# Ignore vim swap files
*.swp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The `terraform-docs` utility is used to generate this README. Follow the below s
| <a name="input_monitors"></a> [monitors](#input\_monitors) | A collection of cost anomaly monitors to create | <pre>list(object({<br/> name = string<br/> # The name of the monitor <br/> monitor_type = optional(string, "DIMENSIONAL")<br/> # The type of monitor to create <br/> monitor_dimension = optional(string, "DIMENSIONAL")<br/> # The dimension to monitor<br/> monitor_specification = optional(string, null)<br/> # The specification to monitor <br/> notify = optional(object({<br/> frequency = string<br/> # The frequency of notifications<br/> threshold_expression = optional(any, null)<br/> # The threshold expression to use for notifications<br/> }), {<br/> frequency = "DAILY"<br/> })<br/> }))</pre> | n/a | yes |
| <a name="input_notifications"></a> [notifications](#input\_notifications) | The configuration of the notification | <pre>object({<br/> email = optional(object({<br/> addresses = list(string)<br/> }), null)<br/> slack = optional(object({<br/> secret_name = optional(string, null)<br/> # An optional secret name in the AWS Secrets Manager, containing this information <br/> lambda_name = optional(string, "cost-anomaly-notification")<br/> # The name of the Lambda function to use for notifications <br/> webhook_url = optional(string, null)<br/> # The URL of the Slack webhook to use for notifications, required if secret_name is not provided<br/> }), null)<br/> })</pre> | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | n/a | yes |
| <a name="input_accounts_id_to_name"></a> [accounts\_id\_to\_name](#input\_accounts\_id\_to\_name) | A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name | `map(string)` | `null` | no |
| <a name="input_accounts_id_to_name_parameter_arn"></a> [accounts\_id\_to\_name\_parameter\_arn](#input\_accounts\_id\_to\_name\_parameter\_arn) | The ARN of your parameter containing the your account ID to name mapping. This ARN will be attached to lambda execution role as a resource, therefore a valid resource must exist. e.g 'arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts\_id\_to\_name\_mapping' to enable the lambda retrieve values from ssm. | `string` | `null` | no |
| <a name="input_enable_notification_creation"></a> [enable\_notification\_creation](#input\_enable\_notification\_creation) | Indicates whether to create a notification lambda stack, default is true, but useful to toggle if using existing resources | `bool` | `true` | no |
| <a name="input_enable_sns_topic_creation"></a> [enable\_sns\_topic\_creation](#input\_enable\_sns\_topic\_creation) | Indicates whether to create an SNS topic within this module | `bool` | `true` | no |
| <a name="input_identity_center_role"></a> [identity\_center\_role](#input\_identity\_center\_role) | The name of the role to use when redirecting through Identity Center | `string` | `null` | no |
Expand Down
10 changes: 4 additions & 6 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ module "cost_anomaly_detection" {
webhook_url = "https://hooks.slack.com/services/FAKE/URL"
}
}
tags = var.tags
accounts_id_to_name = {
"1234567890" = "mgmt"
}
identity_center_start_url = null
identity_center_role = null
tags = var.tags
accounts_id_to_name_parameter_arn = "arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts_id_to_name_mapping"
identity_center_start_url = null
identity_center_role = null
}
8 changes: 3 additions & 5 deletions examples/existing_sns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ module "cost_anomaly_detection" {
}
}

accounts_id_to_name = {
"1234567890" = "mgmt"
}
identity_center_start_url = null
identity_center_role = null
accounts_id_to_name_parameter_arn = "arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts_id_to_name_mapping"
identity_center_start_url = null
identity_center_role = null
}
22 changes: 11 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

## Provision the SNS topic for the cost anomaly detection, if required
module "notifications" {

Check failure on line 3 in main.tf

View workflow job for this annotation

GitHub Actions / Module Validation / Static Security Analysis - Checkov

CKV_TF_1: "Ensure Terraform module sources use a commit hash"
count = var.enable_notification_creation ? 1 : 0
source = "appvia/notifications/aws"
version = "1.1.0"
version = "2.0.0"

allowed_aws_services = ["budgets.amazonaws.com", "costalerts.amazonaws.com", "lambda.amazonaws.com"]
create_sns_topic = local.enable_sns_topic_creation
email = local.email
enable_slack = local.enable_slack
slack = local.slack
sns_topic_name = var.sns_topic_name
tags = var.tags
accounts_id_to_name = var.accounts_id_to_name
identity_center_start_url = var.identity_center_start_url
identity_center_role = var.identity_center_role
allowed_aws_services = ["budgets.amazonaws.com", "costalerts.amazonaws.com", "lambda.amazonaws.com"]
create_sns_topic = local.enable_sns_topic_creation
email = local.email
enable_slack = local.enable_slack
slack = local.slack
sns_topic_name = var.sns_topic_name
tags = var.tags
accounts_id_to_name_parameter_arn = var.accounts_id_to_name_parameter_arn
identity_center_start_url = var.identity_center_start_url
identity_center_role = var.identity_center_role
}

## Provision the cost anomaly detection for services
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ variable "tags" {
type = map(string)
}

variable "accounts_id_to_name" {
description = "A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name"
type = map(string)
variable "accounts_id_to_name_parameter_arn" {
description = "The ARN of your parameter containing the your account ID to name mapping. This ARN will be attached to lambda execution role as a resource, therefore a valid resource must exist. e.g 'arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts_id_to_name_mapping' to enable the lambda retrieve values from ssm."
type = string
default = null
}

Expand Down