I am trying to use a different user along with a custom policy to execute my Terraform plan command but I am not able to figure out what policy action I am missing to run this command. I don't want to allow ec2:*
.
The resources are already running, we are just trying to move the code to a different project.
When I run the plan with ec2:*
permissions it's working correctly.
Error:
Error refreshing state: 2 error(s) occurred:
* module.mesos.aws_instance.master: 3 error(s) occurred:
* module.mesos.aws_instance.master[2]: aws_instance.master.2: UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: 484574e1-0dd0-4c43-b829-42c034763bad
* module.mesos.aws_instance.master[1]: aws_instance.master.1: UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: e0499d28-d55c-46e8-af1a-91262427b422
* module.mesos.aws_instance.master[0]: aws_instance.master.0: UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: f1fb50ac-7bb5-47d6-b1b4-b24b38a61fdd
* module.mesos.data.aws_ami.agent: 1 error(s) occurred:
* module.mesos.data.aws_ami.agent: data.aws_ami.agent: UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: a7dcf75b-30d1-4c74-8c30-a002644db313
Code:
{
"Sid": "gitec2",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeVolumeStatus",
"ec2:StartInstances",
"ec2:DescribeVolumes",
"ec2:RunInstances",
"ec2:StopInstances",
"ec2:AssignPrivateIpAddresses",
"ec2:DescribeVolumeAttribute",
"ec2:DescribeSubnets",
"ec2:AttachVolume",
"ec2:DescribeRegions",
"ec2:DescribeVpcAttribute",
"ec2:DescribeAvailabilityZones",
"ec2:DescribeInstanceStatus",
"ec2:DescribeSecurityGroups",
"ec2:DescribeVpcs",
"ec2:DescribeNetworkAcls",
"ec2:DescribeRouteTables",
"ec2:DescribeLaunchTemplates",
"ec2:DescribeAddresses",
"ec2:DescribeInstanceAttributes",
"ec2:DescribeNetworkInterfaces",
"ec2:CreateSecurityGroup",
"ec2:TerminateInstances",
"ec2:DescribeIamInstanceProfileAssociations",
"ec2:DescribeTags",
"ec2:DescribeImageAttribute",
"ec2:DescribeSecurityGroupReferences",
"ec2:AssociateIamInstanceProfile",
"ec2:AttachInternetGateway",
"ec2:AttachNetworkGateway",
"ec2:AssociateIamInstanceProfile",
"ec2:DeleteSecurityGroup"
],
"Resource": "*"
}