Skip to content

Commit def9515

Browse files
committed
refactor: change the naming of some terraform vars for consistency
1 parent 8792871 commit def9515

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

modules/ami-updater/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
locals {
22
lambda_zip = "${path.module}/../../lambdas/functions/ami-updater/dist/ami-updater.zip"
3-
role_path = var.role_path == null ? "/${var.environment}/" : var.role_path
3+
role_path = var.role_path == null ? "/${var.prefix}/" : var.role_path
44
tags = merge(
55
{
6-
Environment = var.environment
7-
Name = "${var.environment}-ami-updater"
6+
Environment = var.prefix
7+
Name = "${var.prefix}-ami-updater"
88
},
99
var.tags
1010
)
@@ -13,7 +13,7 @@ locals {
1313
resource "aws_lambda_function" "ami_updater" {
1414
filename = local.lambda_zip
1515
source_code_hash = filebase64sha256(local.lambda_zip)
16-
function_name = "${var.environment}-ami-updater"
16+
function_name = "${var.prefix}-ami-updater"
1717
role = aws_iam_role.ami_updater.arn
1818
handler = "index.handler"
1919
runtime = var.lambda_runtime
@@ -56,7 +56,7 @@ resource "aws_cloudwatch_log_group" "ami_updater" {
5656
}
5757

5858
resource "aws_cloudwatch_event_rule" "ami_updater" {
59-
name = "${var.environment}-ami-updater"
59+
name = "${var.prefix}-ami-updater"
6060
description = "Trigger AMI updater Lambda function"
6161
schedule_expression = var.schedule_expression
6262
state = var.state
@@ -78,7 +78,7 @@ resource "aws_lambda_permission" "ami_updater" {
7878
}
7979

8080
resource "aws_iam_role" "ami_updater" {
81-
name = "${var.environment}-ami-updater"
81+
name = "${var.prefix}-ami-updater"
8282
assume_role_policy = data.aws_iam_policy_document.lambda_assume_role_policy.json
8383
path = local.role_path
8484
permissions_boundary = var.role_permissions_boundary

modules/ami-updater/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
variable "environment" {
2-
description = "The environment name for the resources."
1+
variable "prefix" {
2+
description = "The prefix used for naming resources"
33
type = string
44
}
55

0 commit comments

Comments
 (0)