From b46a2002265719fd8a71b706de7a4a950ed978ac Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sun, 9 Oct 2022 12:42:18 -0400 Subject: [PATCH] infra: add tagging to resources (#17) --- infrastructure/app/locals.tf | 15 +++++++++++++ infrastructure/app/{app.tf => main.tf} | 30 ++++++++++++-------------- infrastructure/app/providers.tf | 13 +++++++++++ infrastructure/app/variables.tf | 8 +++++++ script/apply | 4 ++-- script/plan | 4 ++-- 6 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 infrastructure/app/locals.tf rename infrastructure/app/{app.tf => main.tf} (88%) create mode 100644 infrastructure/app/providers.tf diff --git a/infrastructure/app/locals.tf b/infrastructure/app/locals.tf new file mode 100644 index 0000000..4076ed8 --- /dev/null +++ b/infrastructure/app/locals.tf @@ -0,0 +1,15 @@ +locals { + service_name = "lambda-boilerplate" +} + +locals { + service_longname = "${var.env_name}_${local.service_name}" +} + +locals { + common_tags = { + stack_name = local.service_longname + environment_name = var.env_name + commit_sha = var.commit_sha + } +} diff --git a/infrastructure/app/app.tf b/infrastructure/app/main.tf similarity index 88% rename from infrastructure/app/app.tf rename to infrastructure/app/main.tf index 5bc2ee8..8759888 100644 --- a/infrastructure/app/app.tf +++ b/infrastructure/app/main.tf @@ -1,18 +1,5 @@ -terraform { - required_version = ">=1.0" - - required_providers { - aws = "4.34.0" - } -} - -provider "aws" { - profile = "default" - region = var.aws_region -} - resource "aws_iam_role" "lambda_role" { - name = "lambda_role" + name = "${local.service_longname}_lambda-role" assume_role_policy = <