Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Task Exec. policy ARN as an input variable or default to AmazonECSTaskExecutionRolePolicy #7

Closed
bsuv opened this issue May 26, 2018 · 7 comments

Comments

@bsuv
Copy link

bsuv commented May 26, 2018

policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"

When I tried to use atlantis plan or apply I found that it needed permissions for at least for (depending on the config files of course):

    • access to the backend (say S3)
    • access to IAM
      among others.

Initially I began by attaching existing policies, before I determine the which ones are most restrictive. Alternatively, one could pass the overly permissive https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator if they're confident that the Task runs securely.

@ldormoy
Copy link
Contributor

ldormoy commented Aug 24, 2018

I'm also interested in having policy_arn as an input variable that defaults to its current value.

Right now I have to include AWS CLI credentials into the docker image, which isn't optimal from a security PoV.

antonbabenko added a commit that referenced this issue Sep 7, 2018
#7 pass ECs task exec. policy as input variable
@antonbabenko
Copy link
Member

@ldormoy has fixed it, and v1.4.0 has been just released.

Sorry that it took so long to get this issue resolved - all PRs are very much appreciated, because I don't have enough time to fix them all alone.

@kerin
Copy link

kerin commented Dec 19, 2018

I've just tried this, and it does not work if the policy ARN is a computed value, or anything other than a string literal:

data "aws_iam_policy_document" "atlantis_terraform" {
  statement {
    actions = ["ec2:*"]
    resources = ["*"]
    effect = "Allow"
  }
}

resource "aws_iam_policy" "atlantis_terraform" {
  name   = "atlantis-terraform"
  policy = "${data.aws_iam_policy_document.atlantis_terraform.json}"
}

module "atlantis" {
  source  = "terraform-aws-modules/atlantis/aws"
  version = "1.5.1"

  name = "atlantis"

  policies_arn = [
    "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
    "${aws_iam_policy.atlantis_terraform.arn}"
  ]
}

When running:

$ terraform plan
...
Error: Error refreshing state: 1 error(s) occurred:

* module.atlantis.aws_iam_role_policy_attachment.ecs_task_execution: aws_iam_role_policy_attachment.ecs_task_execution: value of 'count' cannot be computed

It looks to me like the only means of having Atlantis run with AWS credentials using this module is to bake static creds into the atlantis container, unless I'm missing something?

@statwoodland
Copy link

statwoodland commented Feb 14, 2019

I'm getting the same error as kerin.

Terraform v0.11.11 and this module's release v1.11.0

@chenrui333
Copy link
Contributor

I am curious how we can deal with the credentials usage for stuff other than AWS resources?

@bryantbiggs
Copy link
Member

this issue appears to be resolved with the latest versions - please update and let us know if there are any additional issues that need attention, thank you!

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants