From 0ba29625c296bb1acc1355962dc6d855924f15ef Mon Sep 17 00:00:00 2001 From: Clayton Burlison Date: Tue, 20 Apr 2021 14:35:33 -0500 Subject: [PATCH] fix: Use var.name for more resources This allows users to reuse this module multiple times within one AWS account --- cloudfront.tf | 5 ++--- cloudwatch.tf | 3 +-- policy.tf | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cloudfront.tf b/cloudfront.tf index 14889c9..100a474 100644 --- a/cloudfront.tf +++ b/cloudfront.tf @@ -15,7 +15,7 @@ resource "aws_cloudfront_distribution" "munki" { enabled = true is_ipv6_enabled = true - comment = "Munki" + comment = var.name aliases = var.cf_dns_aliases @@ -165,7 +165,7 @@ resource "aws_cloudfront_distribution" "munki_basic_auth" { enabled = true is_ipv6_enabled = true - comment = "Munki" + comment = var.name aliases = var.cf_dns_aliases @@ -301,4 +301,3 @@ resource "aws_cloudfront_distribution" "munki_basic_auth" { ssl_support_method = var.cf_ssl_support_method } } - diff --git a/cloudwatch.tf b/cloudwatch.tf index d8cc10d..7e10d6d 100644 --- a/cloudwatch.tf +++ b/cloudwatch.tf @@ -1,5 +1,5 @@ resource "aws_cloudwatch_log_group" "munki_makecatalogs" { - name = "/aws/lambda/munki_makecatalogs" + name = "/aws/lambda/${var.name}_makecatalogs" retention_in_days = "30" tags = merge( @@ -65,4 +65,3 @@ resource "aws_cloudwatch_metric_alarm" "Makecatalogs-Error" { alarm_actions = [var.alarm_arn] insufficient_data_actions = [] } - diff --git a/policy.tf b/policy.tf index b3a9398..0cfafa5 100644 --- a/policy.tf +++ b/policy.tf @@ -1,5 +1,5 @@ resource "aws_iam_policy" "munki-s3-rw" { - name = "munki-s3-rw" + name = "${var.name}-s3-rw" path = "/" description = "Munki s3 policy for read/write access to the s3 munki repo bucket. Used for automation purposes." @@ -32,4 +32,3 @@ resource "aws_iam_policy" "munki-s3-rw" { EOF } -