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

aws_opsworks_permission fails to update own permissions #4804

Closed
ghost opened this issue Jun 11, 2018 · 4 comments · Fixed by #11379
Closed

aws_opsworks_permission fails to update own permissions #4804

ghost opened this issue Jun 11, 2018 · 4 comments · Fixed by #11379
Labels
bug Addresses a defect in current functionality. service/opsworks Issues and PRs that pertain to the opsworks service.
Milestone

Comments

@ghost
Copy link

ghost commented Jun 11, 2018

When using aws_opsworks_permission to update (read: create works) the opsworks permissions of your own user it fails with "ValidationException: Unable to change own permission level. Only AllowSsh and AllowSudo allowed." even when level is unset.

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 "me too" comments, 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

Terraform Version

Terraform v0.11.7
+ provider.aws v1.22.0
+ provider.template v1.0.0

Affected Resource(s)

  • aws_opsworks_permission

Terraform Configuration Files

First run:

Where the opsworks_permission_user_arn variable is a list that contains your iam_arn and at least one other to prove the issue only applies to when making changes to your own iam user.

variable "opsworks_permission_user_arn" {
  type        = "list"
  description = "A list of user arns that should be given access to the stack."
}

resource "aws_opsworks_permission" "stack_permission" {
  count      = "${length(var.opsworks_permission_user_arn)}"
  allow_ssh  = true
  allow_sudo = true
  user_arn   = "${var.opsworks_permission_user_arn[count.index]}"
  stack_id   = "${aws_opsworks_stack.main.id}"
}

Second run:

Where the opsworks_permission_user_arn variable is a list that contains your iam_arn and at least one other to prove the issue only applies to when making changes to your own iam user.

variable "opsworks_permission_user_arn" {
  type        = "list"
  description = "A list of user arns that should be given access to the stack."
}

resource "aws_opsworks_permission" "stack_permission" {
  count      = "${length(var.opsworks_permission_user_arn)}"
  allow_ssh  = true
  allow_sudo = false
  user_arn   = "${var.opsworks_permission_user_arn[count.index]}"
  stack_id   = "${aws_opsworks_stack.main.id}"
}

Expected Behavior

All users should now be allowed to SSH in (allow_ssh = true) but shouldn't have sudo permissions ('allow_sudo = false').

Actual Behavior

All users in the list will have had their sudo permissions revoked except your own IAM user.

Steps to Reproduce

  1. terraform apply
  2. Update allow_sudo from true to false.
  3. terraform apply

References

@radeksimko radeksimko added bug Addresses a defect in current functionality. service/opsworks Issues and PRs that pertain to the opsworks service. labels Jun 13, 2018
@bflad
Copy link
Contributor

bflad commented Dec 20, 2019

Bug fix submitted: #11379

bflad added a commit that referenced this issue Dec 20, 2019
…ssion level` error during self updates

Reference: #4804

Output from acceptance testing before code change:

```
--- FAIL: TestAccAWSOpsworksPermission_Self (51.18s)
    testing.go:640: Step 1 error: errors during apply:

        Error: ValidationException: Unable to change own permission level. Only AllowSsh and AllowSudo allowed.
```

Output from acceptance testing after code change:

```
--- PASS: TestAccAWSOpsworksPermission_Self (64.52s)
--- PASS: TestAccAWSOpsworksPermission_basic (104.39s)
```
bflad added a commit that referenced this issue Jan 10, 2020
…ssion level` error during self updates (#11379)

Reference: #4804

Output from acceptance testing before code change:

```
--- FAIL: TestAccAWSOpsworksPermission_Self (51.18s)
    testing.go:640: Step 1 error: errors during apply:

        Error: ValidationException: Unable to change own permission level. Only AllowSsh and AllowSudo allowed.
```

Output from acceptance testing after code change:

```
--- PASS: TestAccAWSOpsworksPermission_Self (64.52s)
--- PASS: TestAccAWSOpsworksPermission_basic (104.39s)
```
@bflad bflad added this to the v2.45.0 milestone Jan 10, 2020
@bflad
Copy link
Contributor

bflad commented Jan 10, 2020

The fix for this has been merged and will release with version 2.45.0 of the Terraform AWS Provider, Thursday next week.

@ghost
Copy link

ghost commented Jan 17, 2020

This has been released in version 2.45.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 for triage. Thanks!

@github-actions
Copy link

github-actions bot commented Jun 2, 2021

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 Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/opsworks Issues and PRs that pertain to the opsworks service.
Projects
None yet
2 participants