Skip to main content
The db_instance_role_association submodule creates an aws_db_instance_role_association resource, linking an IAM role to an RDS DB instance for a named feature (e.g. S3 integration, Lambda access). The root module uses this submodule via for_each over the db_instance_role_associations map variable.

Source

How the root module uses this submodule

The root module creates one association per entry in the db_instance_role_associations map:
To use role associations via the root module, set db_instance_role_associations:
The map key becomes the feature_name and the map value becomes the role_arn.

Standalone usage

To use this submodule directly — for example when the DB instance is managed by a separate module:
The feature_name must match the RDS feature name exactly as recognized by the AWS API. Common values include s3Import, s3Export, Lambda, and SageMaker.

Input variables

bool
Determines whether to create the DB instance role association resource.Default: true
string
The name of the RDS feature to associate with the IAM role. Common values: s3Import, s3Export, Lambda, SageMaker.Default: null
string
The Amazon Resource Name (ARN) of the IAM role to associate with the DB instance.Default: null
string
The identifier of the DB instance to associate with the IAM role.Default: null
string
Region where the association will be managed. Defaults to the region set in the provider configuration.Default: null

Outputs

string
The association ID, formatted as db_instance_identifier,role_arn. This is the composite identifier used by the AWS provider.