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

support ability to use aws_iam_policy_document instead of directly having a policy doc in the resource #152

Open
fawaf opened this issue Dec 2, 2020 · 0 comments
Labels
Feature roadmap feature Provider: AWS Issues related to the AWS Provider

Comments

@fawaf
Copy link

fawaf commented Dec 2, 2020

Abstract

iam policies are currently in-line in resources. this feature would be to support generating the aws_iam_policy_document data source of terraform to be used in resource definitions.

Proposal

e.g.

data "aws_iam_policy_document" "foo" {
  statement {
      effect = "Allow"
      principals {
        type = "AWS"
        identifiers = [
          "arn:aws:iam::blah"
        ]
      }
      actions = "sts:AssumeRole"
  }
}

resource "aws_iam_role" "backups" {
    name               = "backups"
    path               = "/"
    assume_role_policy = data.aws_iam_policy_document.foo.json
}

vs

resource "aws_iam_role" "foo" {
    name               = "backups"
    path               = "/"
    assume_role_policy = <<POLICY
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::blah"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
POLICY
}

Implementation

Open issues (if applicable)

@fawaf fawaf added the Feature roadmap feature label Dec 2, 2020
@xescugc xescugc added the Provider: AWS Issues related to the AWS Provider label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature roadmap feature Provider: AWS Issues related to the AWS Provider
Projects
None yet
Development

No branches or pull requests

2 participants