Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ module "services_common" {
lambda_responses_s3_bucket_arn = module.storage.lambda_responses_bucket_arn
service_additional_policy_arns = var.service_additional_policy_arns
brainstore_additional_policy_arns = var.brainstore_additional_policy_arns
brainstore_enable_export = var.brainstore_enable_export
permissions_boundary_arn = var.permissions_boundary_arn
eks_cluster_arn = var.existing_eks_cluster_arn
eks_namespace = var.eks_namespace
Expand Down
4 changes: 4 additions & 0 deletions modules/services-common/iam-api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ resource "aws_iam_role" "api_handler_role" {
permissions_boundary = var.permissions_boundary_arn

tags = local.common_tags

lifecycle {
ignore_changes = [name]
}
}

resource "aws_iam_role_policy_attachment" "api_handler_policy" {
Expand Down
27 changes: 27 additions & 0 deletions modules/services-common/iam-brainstore.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ resource "aws_iam_role" "brainstore_role" {
tags = merge({
Name = "${var.deployment_name}-brainstore-ec2-role"
}, local.common_tags)

lifecycle {
ignore_changes = [name]
}
}

resource "aws_iam_role_policy" "brainstore_s3_access" {
Expand Down Expand Up @@ -125,6 +129,29 @@ resource "aws_iam_role_policy" "brainstore_secrets_access" {
})
}

resource "aws_iam_role_policy" "brainstore_export_assume_role" {
Comment thread
jeffmccollum marked this conversation as resolved.
count = var.brainstore_enable_export ? 1 : 0

name = "export-assume-role"
role = aws_iam_role.brainstore_role.id

policy = jsonencode({ # nosemgrep
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Resource = "*"
Condition = {
StringLike = {
"sts:ExternalId" = "bt:*"
}
}
}
]
})
}

resource "aws_iam_role_policy" "brainstore_cloudwatch_metrics" {
name = "cloudwatch-agent-metrics"
role = aws_iam_role.brainstore_role.id
Expand Down
6 changes: 6 additions & 0 deletions modules/services-common/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ variable "brainstore_additional_policy_arns" {
default = []
}

variable "brainstore_enable_export" {
type = bool
description = "Enable Brainstore-based export IAM permissions."
default = false
}

variable "enable_brainstore_ec2_ssm" {
description = "Optional. true will enable ssm (session manager) for the brainstore EC2s. Helpful for debugging without changing firewall rules"
type = bool
Expand Down
Loading