You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/enos/modules/aws_boundary/iam.tf

49 lines
1.2 KiB

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
data "aws_iam_policy_document" "boundary_instance_role" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
}
}
data "aws_iam_policy_document" "boundary_profile" {
statement {
resources = ["*"]
actions = ["ec2:DescribeInstances"]
}
statement {
resources = [var.kms_key_arn]
actions = [
"kms:DescribeKey",
"kms:ListKeys",
"kms:Encrypt",
"kms:Decrypt",
]
}
}
resource "aws_iam_role" "boundary_instance_role" {
name = "boundary_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.boundary_instance_role.json
}
resource "aws_iam_instance_profile" "boundary_profile" {
name = "boundary_instance_profile-${random_string.cluster_id.result}"
role = aws_iam_role.boundary_instance_role.name
}
resource "aws_iam_role_policy" "boundary_policy" {
name = "boundary_policy-${random_string.cluster_id.result}"
role = aws_iam_role.boundary_instance_role.id
policy = data.aws_iam_policy_document.boundary_profile.json
}