Skip to content

Commit

Permalink
refactor: rename IAM resources (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardolsmendes authored Mar 11, 2024
1 parent dfd45f1 commit c2332d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion infrastructure/modules/glue/catalog.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/modules/glue/etl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/modules/glue/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit c2332d3

Please sign in to comment.