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

SSO: Support for permission boundary policies #25893

Closed
kuuji opened this issue Jul 19, 2022 · 8 comments · Fixed by #28241
Closed

SSO: Support for permission boundary policies #25893

kuuji opened this issue Jul 19, 2022 · 8 comments · Fixed by #28241
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. service/ssoadmin Issues and PRs that pertain to the ssoadmin service.
Milestone

Comments

@kuuji
Copy link

kuuji commented Jul 19, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

https://aws.amazon.com/about-aws/whats-new/2022/07/aws-single-sign-on-aws-sso-aws-identity-access-management-iam-customer-managed-policies-cmps/ both just got released to AWS SSO. These improve the flexibility over the current inline policy + aws managed.

New or Affected Resource(s)

As it is, the inline and managed policy attachments are designed to attach to an existing permission set. So this addition shouldn't impact existing resources

Potential Terraform Configuration

I suppose the interface would be very similar to the current aws managed policy https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_managed_policy_attachment

data "aws_ssoadmin_instances" "example" {}

resource "aws_ssoadmin_permission_set" "example" {
  name         = "Example"
  instance_arn = tolist(data.aws_ssoadmin_instances.example.arns)[0]
}

resource "aws_ssoadmin_customer_managed_policy_attachment" "example" {
  instance_arn       = tolist(data.aws_ssoadmin_instances.example.arns)[0]
  customer_managed_policy_arn = "<policy_arn>"
  permission_set_arn = aws_ssoadmin_permission_set.example.arn
}

References

edit: changing this issue to be specific to permission boundary since there's another issue for CMPs

@kuuji kuuji added the enhancement Requests to existing resources that expand the functionality or scope. label Jul 19, 2022
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ssoadmin Issues and PRs that pertain to the ssoadmin service. labels Jul 19, 2022
@justinretzolk
Copy link
Member

Related: #25904

@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 21, 2022
@lorengordon
Copy link
Contributor

Since #25904 is specific to customer managed policies, perhaps this issue can be updated so it is specific to only the permission boundary?

@kuuji
Copy link
Author

kuuji commented Jul 21, 2022

I can do that @lorengordon .

@kuuji kuuji changed the title SSO: Support for customer managed policies (CMPs) and permission boundary policies SSO: Support for permission boundary policies Jul 21, 2022
@odg0318
Copy link

odg0318 commented Aug 30, 2022

Let's discuss the code interface to add boundary policy. The parameters are found in this document.

parameters

{
   "InstanceArn": "string",
   "PermissionsBoundary": {
      "CustomerManagedPolicyReference": {
         "Name": "string",
         "Path": "string"
      },
      "ManagedPolicyArn": "string"
   },
   "PermissionSetArn": "string"
}

Suggested code

One of customer_managed_policy_name and managed_policy_arn must be set here. When I look at the AWS GUI, there is no field for CustomerManagedPolicyReference.Path on UI so it can be assigned to null.

data "aws_ssoadmin_instances" "example" {}

resource "aws_ssoadmin_permission_set" "example" {
  name         = "Example"
  instance_arn = tolist(data.aws_ssoadmin_instances.example.arns)[0]
}

resource "aws_ssoadmin_permission_set_boundary_policy" "example" {
  instance_arn       = tolist(data.aws_ssoadmin_instances.example.arns)[0]
  permission_set_arn = aws_ssoadmin_permission_set.example.arn

  customer_managed_policy_name = "<policy_name>"
  customer_managed_policy_path = "<policy_path>"
  managed_policy_arn           = "<policy_arn>"
}

@josemdav
Copy link

Perhaps having the interface to specify the boundary in a similar way that the AWS SSO API it's more consistent. The same was done in the ssoadmin_customer_managed_policy_attachment

data "aws_ssoadmin_instances" "example" {}

resource "aws_ssoadmin_permission_set" "example" {
  name         = "Example"
  instance_arn = tolist(data.aws_ssoadmin_instances.example.arns)[0]
}

resource "aws_ssoadmin_permission_set_boundary_policy" "example" {
  instance_arn       = tolist(data.aws_ssoadmin_instances.example.arns)[0]
  permission_set_arn = aws_ssoadmin_permission_set.example.arn

  permissions_boundary  {
    customer_managed_policy_reference {
      name = "policy_name"
      path = "/"
    }
  }
}

or

data "aws_ssoadmin_instances" "example" {}

resource "aws_ssoadmin_permission_set" "example" {
  name         = "Example"
  instance_arn = tolist(data.aws_ssoadmin_instances.example.arns)[0]
}

resource "aws_ssoadmin_permission_set_boundary_policy" "example" {
  instance_arn       = tolist(data.aws_ssoadmin_instances.example.arns)[0]
  permission_set_arn = aws_ssoadmin_permission_set.example.arn

  permissions_boundary  {
    managed_policy_arn = "managed_policy_arn"
  }
}

I wonder how to conditionally go with one option or the other when creating modules using this resource

@github-actions
Copy link

This functionality has been released in v4.47.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

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 Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. service/ssoadmin Issues and PRs that pertain to the ssoadmin service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants