Skip to content

Commit

Permalink
change ssm option to be sm
Browse files Browse the repository at this point in the history
Signed-off-by: guyrenny <[email protected]>
  • Loading branch information
guyrenny committed Oct 1, 2023
1 parent aed6b7c commit e608893
Show file tree
Hide file tree
Showing 26 changed files with 79 additions and 54 deletions.
4 changes: 2 additions & 2 deletions examples/cloudwatch-logs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ variable "tags" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand All @@ -109,7 +109,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
4 changes: 2 additions & 2 deletions examples/kinesis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ variable "tags" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand All @@ -92,7 +92,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
2 changes: 1 addition & 1 deletion examples/lambda-secretLayer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# secret-lambdaLayer:

This application will create an SSM layer to use in our integrations.
This application will create an SM layer to use in our integrations.
You will need to deploy one layer per AWS Region you want to use.
Currently the layer support only NodeJS runtimes.

Expand Down
4 changes: 2 additions & 2 deletions examples/lambda-secretLayer/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output "lambda_layer_version_arn" {
description = "Lambda Layer version ARN for coralogix-ssmlayer"
value = aws_lambda_layer_version.coralogix_ssmlayer.arn
description = "Lambda Layer version ARN for coralogix-smlayer"
value = aws_lambda_layer_version.coralogix_smlayer.arn
}
4 changes: 2 additions & 2 deletions examples/resource-metadata/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "private_key" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand Down Expand Up @@ -92,7 +92,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
4 changes: 2 additions & 2 deletions examples/s3/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ variable "private_key" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand Down Expand Up @@ -141,7 +141,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
3 changes: 3 additions & 0 deletions modules/cloudwatch-logs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## cloudwatch-logs

### 0.0.4 / 1.10.2023
* [Change] Change SSM option in the integration to SM - Secret Manager.

### 0.0.3 / 16.8.2023
* [Update] Add an option to use an existing secret instead of creating a new one with SSM, and remove ssm_enabled variable.

Expand Down
11 changes: 8 additions & 3 deletions modules/cloudwatch-logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Manage the application which retrieves `CloudWatch` logs and sends them to your
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.23 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | Cloudwatch log group|

### Note:
* in case you use SM(Secret Manager) you should first deploy the [SM lambda layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer)

## Providers

| Name | Version |
Expand All @@ -29,8 +32,8 @@ Manage the application which retrieves `CloudWatch` logs and sends them to your
|------|-------------|------|---------|:--------:|
| <a name="input_coralogix_region"></a> [coralogix\_region](#input\_coralogix\_region) | The Coralogix location region, possible options are [`Europe`, `Europe2`, `India`, `Singapore`, `US`, `US2`] | `string` | `Europe` | yes |
| <a name="input_custom_url"></a> [custom_url](#input\_custom\_domain) | Custom url for coralogix | `string` | n/a | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you are using SSM This is the ARN of the Coralogix Security Layer. | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SSM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you want to use SM This is the ARN of the Coralogix [Security Layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer). | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_private_key"></a> [private\_key](#input\_private\_key) | Your Coralogix secret key or incase you use your own created secret put here the name of your secret that contains the coralogix Private Key| `string` | n/a | yes |
| <a name="input_application_name"></a> [application\_name](#input\_application\_name) | The name of your application | `string` | n/a | yes |
| <a name="input_subsystem_name"></a> [subsystem\_name](#input\_subsystem\_name) | The subsystem name of your application | `string` | n/a | yes |
Expand All @@ -48,7 +51,9 @@ Manage the application which retrieves `CloudWatch` logs and sends them to your
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |

### Note:
You should use the `custom_s3_bucket` variable only when you need to deploy the integration in aws region that coralogix doesn't have a public bucket in (i.e for GovCloud), when using this variable you will need to create a bucket in the region that you want to run the integration in, and pass this bucket name as `custom_s3_bucket`. The module will download the integration file to your local workspace, and then upload these files to the `custom_s3_bucket`, and remove the file from your local workspace.
* You should use the `custom_s3_bucket` variable only when you need to deploy the integration in aws region that coralogix doesn't have a public bucket in (i.e for GovCloud), when using this variable you will need to create a bucket in the region that you want to run the integration in, and pass this bucket name as `custom_s3_bucket`. The module will download the integration file to your local workspace, and then upload these files to the `custom_s3_bucket`, and remove the file from your local workspace.

* You can use log field as `Application/Subsystem` names. Use the following syntax: `$.my_log.field`. In case you leave subsystemName as Empty it will be populated from log group name.

## Coralgoix regions
| Coralogix region | AWS Region | Coralogix Domain |
Expand Down
8 changes: 4 additions & 4 deletions modules/cloudwatch-logs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module "lambda" {
tags = merge(var.tags, module.locals.tags)
}

module "lambdaSSM" {
module "lambdaSM" {
source = "terraform-aws-modules/lambda/aws"
version = "3.3.1"
create = var.layer_arn != "" ? true : false
Expand Down Expand Up @@ -143,7 +143,7 @@ resource "aws_cloudwatch_log_subscription_filter" "this" {
count = length(var.log_groups)
name = "${module.lambda.lambda_function_name}-Subscription-${count.index}"
log_group_name = data.aws_cloudwatch_log_group.this[count.index].name
destination_arn = var.layer_arn != "" ? module.lambdaSSM.lambda_function_arn : module.lambda.lambda_function_arn
destination_arn = var.layer_arn != "" ? module.lambdaSM.lambda_function_arn : module.lambda.lambda_function_arn
filter_pattern = ""
}

Expand All @@ -154,7 +154,7 @@ resource "aws_sns_topic" "this" {
}

resource "aws_sns_topic_subscription" "this" {
depends_on = [aws_sns_topic.this, module.lambdaSSM, module.lambda]
depends_on = [aws_sns_topic.this, module.lambdaSM, module.lambda]
count = var.notification_email != null ? 1 : 0
topic_arn = aws_sns_topic.this.arn
protocol = "email"
Expand All @@ -163,7 +163,7 @@ resource "aws_sns_topic_subscription" "this" {

resource "aws_secretsmanager_secret" "private_key_secret" {
count = var.layer_arn != "" && var.create_secret == "True" ? 1 : 0
depends_on = [module.lambdaSSM]
depends_on = [module.lambdaSM]
name = "lambda/coralogix/${data.aws_region.this.name}/${module.locals.function_name}"
description = "Coralogix Send Your Data key Secret"
}
Expand Down
4 changes: 2 additions & 2 deletions modules/cloudwatch-logs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ variable "tags" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand All @@ -109,7 +109,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
3 changes: 3 additions & 0 deletions modules/kinesis/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## kinesis

### 0.0.3 / 1.10.2023
* [Change] Change SSM option in the integration to SM - Secret Manager.

### 0.0.2 / 16.8.2023
* [Update] Add an option to use an existing secret instead of creating a new one with SSM, and remove ssm_enabled variable.

Expand Down
7 changes: 5 additions & 2 deletions modules/kinesis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Manage the application which retrieves logs from `S3` bucket and sends them to y
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.23 |

### Note:
* in case you use SM(Secret Manager) you should first deploy the [SM lambda layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer)

## Providers

| Name | Version |
Expand All @@ -28,8 +31,8 @@ Manage the application which retrieves logs from `S3` bucket and sends them to y
|------|-------------|------|---------|:--------:|
| <a name="input_coralogix_region"></a> [coralogix\_region](#input\_coralogix\_region) | The Coralogix location region, possible options are [`Europe`, `Europe2`, `India`, `Singapore`, `US`, `US2`] | `string` | `Europe` | yes |
| <a name="input_custom_url"></a> [custom_url](#input\_custom\_url) | Custom url for coralogix | `string` | n/a | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you are using SSM This is the ARN of the Coralogix Security Layer. | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SSM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you want to use SM This is the ARN of the Coralogix [Security Layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer). | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_private_key"></a> [private\_key](#input\_private\_key) | Your Coralogix secret key or incase you use your own created secret put here the name of your secret that contains the coralogix Private Key| `string` | n/a | yes |
| <a name="input_application_name"></a> [application\_name](#input\_application\_name) | The name of your application | `string` | n/a | yes |
| <a name="input_subsystem_name"></a> [subsystem\_name](#input\_subsystem\_name) | The subsystem name of your application | `string` | n/a | yes |
Expand Down
6 changes: 3 additions & 3 deletions modules/kinesis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module "lambda" {
tags = merge(var.tags, module.locals.tags)
}

module "lambda_ssm" {
module "lambda_sm" {
source = "terraform-aws-modules/lambda/aws"
version = "3.3.1"
create = var.layer_arn != "" ? true : false
Expand Down Expand Up @@ -151,7 +151,7 @@ resource "aws_sns_topic" "this" {
}

resource "aws_sns_topic_subscription" "this" {
depends_on = [aws_sns_topic.this, module.lambda_ssm, module.lambda]
depends_on = [aws_sns_topic.this, module.lambda_sm, module.lambda]
count = var.notification_email != null ? 1 : 0
topic_arn = aws_sns_topic.this.arn
protocol = "email"
Expand All @@ -160,7 +160,7 @@ resource "aws_sns_topic_subscription" "this" {

resource "aws_secretsmanager_secret" "private_key_secret" {
count = var.layer_arn != "" && var.create_secret == "True" ? 1 : 0
depends_on = [module.lambda_ssm]
depends_on = [module.lambda_sm]
name = "lambda/coralogix/${data.aws_region.this.name}/${module.locals.function_name}"
description = "Coralogix Send Your Data key Secret"
}
Expand Down
4 changes: 2 additions & 2 deletions modules/kinesis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ variable "tags" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand All @@ -92,7 +92,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
5 changes: 2 additions & 3 deletions modules/lambda-secretLayer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## lambda-secretLayer

<!-- To add a new entry write: -->
<!-- ### version / full date -->
<!-- * [Update/Bug fix] message that describes the changes that you apply -->
### 0.0.1 / 1.10.2023
* [Change] Change SSM option in the integration to SM - Secret Manager.
4 changes: 2 additions & 2 deletions modules/lambda-secretLayer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Coralogx Layer for SSM private_key
## Coralogx Layer for SM private_key

This Lambda Layer allows to store Coralogix Private Key in SSM.
This Lambda Layer allows to store Coralogix Private Key in SM.

You will need to deploy one layer per AWS Region you want to use. For now.

Expand Down
6 changes: 3 additions & 3 deletions modules/lambda-secretLayer/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
data "aws_region" "this" {}

resource "aws_lambda_layer_version" "coralogix_ssmlayer" {
layer_name = "coralogix-ssmlayer"
description = "Lambda function layer for using SSM for PrivateKey safe keeping"
resource "aws_lambda_layer_version" "coralogix_smlayer" {
layer_name = "coralogix-smlayer"
description = "Lambda function layer for using SM for PrivateKey safe keeping"
license_info = "Apache-2.0"
compatible_runtimes = ["nodejs16.x", "nodejs18.x", "nodejs14.x"]
compatible_architectures = ["x86_64", "arm64"]
Expand Down
4 changes: 2 additions & 2 deletions modules/lambda-secretLayer/output.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output "lambda_layer_version_arn" {
description = "Lambda Layer version ARN for coralogix-ssmlayer"
value = aws_lambda_layer_version.coralogix_ssmlayer.arn
description = "Lambda Layer version ARN for coralogix-smlayer"
value = aws_lambda_layer_version.coralogix_smlayer.arn
}
3 changes: 3 additions & 0 deletions modules/resource-metadata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## resource-metadata

### 0.0.4 / 1.10.2023
* [Change] Change SSM option in the integration to SM - Secret Manager.

### 0.0.3 / 6.9.2023
* [Bug fix] Remove the IAM role named Default - there is no need for this role and it can cause a conflict.

Expand Down
7 changes: 5 additions & 2 deletions modules/resource-metadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Manage the application which retrieves `meta data` from your aws account and sen
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.23 |

### Note:
* in case you use SM(Secret Manager) you should first deploy the [SM lambda layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer)

## Providers

| Name | Version |
Expand All @@ -28,8 +31,8 @@ Manage the application which retrieves `meta data` from your aws account and sen
|------|-------------|------|---------|:--------:|
| <a name="input_coralogix_region"></a> [coralogix\_region](#input\_coralogix\_region) | The Coralogix location region, possible options are [`Europe`, `Europe2`, `India`, `Singapore`, `US`, `US2`, `Custom`] | `string` | n/a | yes |
| <a name="input_custom_url"></a> [custom_url](#input\_custom\_domain) | Custom url for coralogix for example: https://<your_custom_domain>/api/v1/logs| `string` | n/a | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you are using SSM This is the ARN of the Coralogix Security Layer. | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SSM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_layer_arn"></a> [layer_arn](#input\_layer\_arn) | In case you want to use SM This is the ARN of the Coralogix [Security Layer](https://serverlessrepo.aws.amazon.com/applications/eu-central-1/597078901540/Coralogix-Lambda-SSMLayer). | `string` | n/a | no |
| <a name="input_create_secret"></a> [create_secret](#input\_create\_secret) | Set to False In case you want to use SM with your secret that contains coralogix Private Key| `string` | True | no |
| <a name="input_private_key"></a> [private\_key](#input\_private\_key) | Your Coralogix secret key or incase you use your own created secret put here the name of your secret that contains the coralogix Private Key| `string` | n/a | yes |
| <a name="input_schedule"></a> [schedule](#input\_schedule) | The rate to collacet metadata | `string` | `rate(10 minutes)` | no |
| <a name="input_latest_versions_per_function"></a> [latest_versions_per_function](#input\_latest\_versions\_per\_function) | How many latest published versions of each Lambda function should be collected | `number` | 5 | no |
Expand Down
6 changes: 3 additions & 3 deletions modules/resource-metadata/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module "eventbridge" {
crons = [
{
name = "cron-for-lambda"
arn = var.layer_arn == "" ? module.lambda.lambda_function_arn : module.lambdaSSM.lambda_function_arn
arn = var.layer_arn == "" ? module.lambda.lambda_function_arn : module.lambdaSM.lambda_function_arn
input = jsonencode({ "job" : "cron-by-rate" })
}
]
Expand Down Expand Up @@ -114,7 +114,7 @@ module "lambda" {
tags = merge(var.tags, local.tags)
}

module "lambdaSSM" {
module "lambdaSM" {
create = var.layer_arn != "" ? true : false
depends_on = [ null_resource.s3_bucket ]
source = "terraform-aws-modules/lambda/aws"
Expand Down Expand Up @@ -195,7 +195,7 @@ resource "aws_sns_topic" "this" {

resource "aws_secretsmanager_secret" "private_key_secret" {
count = var.layer_arn != "" && var.create_secret == "True" ? 1 : 0
depends_on = [module.lambdaSSM]
depends_on = [module.lambdaSM]
name = "lambda/coralogix/${data.aws_region.this.name}/${local.function_name}"
description = "Coralogix Send Your Data key Secret"
}
Expand Down
4 changes: 2 additions & 2 deletions modules/resource-metadata/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "private_key" {
}

variable "layer_arn" {
description = "In case you are using SSM This is the ARN of the Coralogix Security Layer."
description = "In case you are using SM This is the ARN of the Coralogix Security Layer."
type = string
default = ""
}
Expand Down Expand Up @@ -92,7 +92,7 @@ variable "custom_s3_bucket" {
}

variable "create_secret" {
description = "Set to False In case you want to use SSM with your secret that contains coralogix private key"
description = "Set to False In case you want to use SM with your secret that contains coralogix private key"
type = string
default = "True"
}
Loading

0 comments on commit e608893

Please sign in to comment.