From c2332d36a0c9e304b2e4f6144eaa19f63c94c361 Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Mon, 11 Mar 2024 16:05:31 -0300 Subject: [PATCH] refactor: rename IAM resources (#49) --- infrastructure/modules/glue/catalog.tf | 2 +- infrastructure/modules/glue/etl.tf | 2 +- infrastructure/modules/glue/iam.tf | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/infrastructure/modules/glue/catalog.tf b/infrastructure/modules/glue/catalog.tf index 4bdb4fd..af6da66 100644 --- a/infrastructure/modules/glue/catalog.tf +++ b/infrastructure/modules/glue/catalog.tf @@ -8,7 +8,7 @@ resource "aws_glue_crawler" "silver_us_legislators" { name = "glue-ci-cd-silver-us-legislators-${var.environment}" description = "Crawler for the US Legislators table (AWS Glue CI/CD Blueprint, Silver layer)" database_name = aws_glue_catalog_database.silver.name - role = aws_iam_role.glue_service.arn + role = aws_iam_role.glue_service_custom.arn s3_target { path = "s3://${var.data_bucket_id}/silver/us-legislators" diff --git a/infrastructure/modules/glue/etl.tf b/infrastructure/modules/glue/etl.tf index 3c29729..3cf285f 100644 --- a/infrastructure/modules/glue/etl.tf +++ b/infrastructure/modules/glue/etl.tf @@ -3,7 +3,7 @@ resource "aws_glue_job" "us_legislators" { name = each.value.name description = each.value.description - role_arn = aws_iam_role.glue_service.arn + role_arn = aws_iam_role.glue_service_custom.arn glue_version = "4.0" worker_type = "G.1X" number_of_workers = 2 diff --git a/infrastructure/modules/glue/iam.tf b/infrastructure/modules/glue/iam.tf index 106dce0..feeb583 100644 --- a/infrastructure/modules/glue/iam.tf +++ b/infrastructure/modules/glue/iam.tf @@ -4,18 +4,18 @@ resource "aws_iam_policy" "glue_service_custom" { policy = data.aws_iam_policy_document.glue_service_custom.json } -resource "aws_iam_role" "glue_service" { +resource "aws_iam_role" "glue_service_custom" { name = "GlueCICDServiceRole-${var.environment}" description = "Role assumed by the Glue services to demonstrate the CI/CD Blueprint." assume_role_policy = data.aws_iam_policy_document.glue_service_trust.json } resource "aws_iam_role_policy_attachment" "glue_service_custom" { - role = aws_iam_role.glue_service.name + role = aws_iam_role.glue_service_custom.name policy_arn = aws_iam_policy.glue_service_custom.arn } -resource "aws_iam_role_policy_attachment" "glue_service_trust" { - role = aws_iam_role.glue_service.name +resource "aws_iam_role_policy_attachment" "glue_service_managed" { + role = aws_iam_role.glue_service_custom.name policy_arn = "arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole" }