// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 data "aws_caller_identity" "current" {} data "aws_iam_policy_document" "instance_role" { statement { effect = "Allow" actions = ["sts:AssumeRole"] principals { type = "Service" identifiers = ["ec2.amazonaws.com"] } } } # NOTE: In the policy below the resource is specified as star as per AWS documentation, since these types of actions are not resources based. # https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonec2.html#amazonec2-actions-as-permissions data "aws_iam_policy_document" "auto_discover_cluster" { statement { effect = "Allow" actions = [ "ec2:DescribeInstances", "ec2:DescribeTags", "autoscaling:Describe*", ] resources = ["*"] } } data "aws_iam_policy" "ssm" { name = "AmazonSSMManagedInstanceCore" } resource "aws_iam_policy" "secretsmanager_policy" { name = "consul-asg-secretsmanager-policy" description = "Policy to retrieve secrets manager secrets string." policy = <