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

[cloudwatch-logs-aggregator] BREAKING CHANGE: Remove AWS provider block from modules #24

Merged
merged 4 commits into from
Jan 24, 2024
Merged
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
17 changes: 11 additions & 6 deletions cloudwatch-logs-aggregator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ The cloudwatch-logs-aggregator-lambda module manages a Lambda function that runs

### Example
``` hcl
provider "aws" {
region = "ap-northeast-1"
// >= 5.27.0 is required
}

module "cw_logs_aggregator_lambda" {
source = "github.com/mackerelio-labs/mackerel-monitoring-modules//cloudwatch-logs-aggregator/lambda?ref=v0.2.2"

region = "ap-northeast-1"
}
```

### Variables
| Name | Description | Default |
| --- | --- | --- |
| `region` | The AWS region in which the resources are created. | |
| `iam_role_name` | The name of the Lambda function's execution role. | `"mackerel-cloudwatch-logs-aggregator-lambda"` |
| `function_name` | The name of the Lambda function. | `"mackerel-cloudwatch-logs-aggregator"` |
| `memory_size_in_mb` | The memory size of the Lambda function, in megabytes. | `128` |
Expand All @@ -52,10 +54,14 @@ You can attach multiple rules for a signle Lambda function.

### Example
``` hcl
provider "aws" {
region = "ap-northeast-1"
// >= 5.27.0 is required
}

module "cw_logs_aggregator_rule_batch_jobs" {
source = "github.com/mackerelio-labs/mackerel-monitoring-modules//cloudwatch-logs-aggregator/rule?ref=v0.2.2"

region = "ap-northeast-1"
rule_name = "mackerel-cloudwatch-logs-aggregator-batch-jobs"
function_arn = module.cw_logs_aggregator_lambda.function_arn

Expand All @@ -77,10 +83,9 @@ module "cw_logs_aggregator_rule_batch_jobs" {
### Variables
| Name | Description | Default |
| --- | --- | --- |
| `region` | The AWS region in which the resources are created. | |
| `rule_name` | The name of the EventBridge rule. | |
| `function_arn` | The ARN of the target Lambda function. | |
| `is_enabled` | Whether the rules is enabled or not. | `true` |
| `state` | Whether the rules is enabled or not. See [the document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule#state) | `"ENABLED"` |
| `api_key_name` | The name of the parameter of Parameter Store which stores the Mackerel API key. It is recommended to store the API key as a secure string. | |
| `service_name` | The name of the service on Mackerel to which metrics are posted. | |
| `log_group_name` | The name of the log group to be aggregated. | |
Expand Down
9 changes: 7 additions & 2 deletions cloudwatch-logs-aggregator/lambda/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
provider "aws" {
region = var.region
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.27.0"
}
}
}

resource "aws_iam_role" "this" {
Expand Down
5 changes: 0 additions & 5 deletions cloudwatch-logs-aggregator/lambda/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
variable "region" {
description = "The AWS region in which the resources are created."
type = string
}

variable "iam_role_name" {
description = "The name of the Lambda function's execution role."
type = string
Expand Down
3 changes: 0 additions & 3 deletions cloudwatch-logs-aggregator/rule/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ terraform {
}
}
}
provider "aws" {
region = var.region
}

resource "aws_cloudwatch_event_rule" "this" {
name = var.rule_name
Expand Down
5 changes: 0 additions & 5 deletions cloudwatch-logs-aggregator/rule/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
variable "region" {
description = "The AWS region in which the resources are created."
type = string
}

variable "rule_name" {
description = "The name of the EventBridge rule."
type = string
Expand Down
Loading