Skip to content

Add support for RDS DB Instance role associations #131

@adamantike

Description

@adamantike

Describe the Feature

Allow the module to internally configure aws_db_instance_role_association resources, to centralize more of the RDS configuration in this single module.

Describe Ideal Solution

Example code snippet, using for_each to have the TF state being indexed by the feature name.

variable "role_associations" {
  type        = map(string)
  description = "Map of role associations for the DB Instance. Key is the name of the feature for association, and value is the IAM Role ARN to associate. (e.g. { s3Import: \"arn:aws:iam::1234567890:role/rds-s3-import-role\" })"
  default     = {}
}

resource "aws_db_instance_role_association" "default" {
  for_each = module.this.enabled ? var.role_associations : {}

  db_instance_identifier = join("", aws_db_instance.default.*.id)
  feature_name           = each.key
  role_arn               = each.value
}

Alternatives Considered

Current alternative is to add these role associations using a separate resource block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions