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

[Bug]: AWS sso can not associate user to permission set and account #27144

Closed
AngeloGelmini opened this issue Oct 7, 2022 · 5 comments · Fixed by #27184
Closed

[Bug]: AWS sso can not associate user to permission set and account #27144

AngeloGelmini opened this issue Oct 7, 2022 · 5 comments · Fixed by #27184
Labels
bug Addresses a defect in current functionality. service/identitystore Issues and PRs that pertain to the identitystore service. service/ssoadmin Issues and PRs that pertain to the ssoadmin service.
Milestone

Comments

@AngeloGelmini
Copy link

AngeloGelmini commented Oct 7, 2022

Terraform Core Version

1.0.0

AWS Provider Version

4.34

Affected Resource(s)

// version used in 4.33
data "aws_identitystore_user" "users" {
  for_each          = toset(local.users[*].name)
  identity_store_id = tolist(data.aws_ssoadmin_instances.selected.identity_store_ids)[0]

  filter {
    attribute_path  = "UserName"
    attribute_value = each.value
  }
}
// with no deprecation given by 4.34
data "aws_identitystore_user" "users" {
  for_each          = toset(local.users[*].name)
  identity_store_id = tolist(data.aws_ssoadmin_instances.selected.identity_store_ids)[0]

  alternate_identifier {
    unique_attribute {
      attribute_path  = "UserName"
      attribute_value = each.value
    }
  }
}
resource "aws_ssoadmin_account_assignment" "users" {
  for_each           = {for val in local.users_privileges: replace("${val.name}-${val.account}-${val.permission}", " ", "_") => val}
  instance_arn       = tolist(data.aws_ssoadmin_instances.selected.arns)[0]
  permission_set_arn = data.aws_ssoadmin_permission_set.list[each.value.permission].arn
  principal_id       = data.aws_identitystore_user.users[each.value.name].user_id
  target_id          = local.accounts_by_name[each.value.account]
  principal_type     = "USER"
  target_type        = "AWS_ACCOUNT"
}

Expected Behavior

with provider 4.33 it associate the user to a permission set and account

Actual Behavior

With both version of aws_identitystore_user we have the same error:

Error: setting AWS SSO Identity Store User Data Source (936*****83c): external_ids.0.id: '' expected type 'bool', got unconvertible type 'string', value: 'b29******94'
  with data.aws_identitystore_user.users["name.surname@example.com"],
  on data.tf line 5, in data "aws_identitystore_user" "users":
   5: data "aws_identitystore_user" "users" {

Relevant Error/Panic Output Snippet

Error: setting AWS SSO Identity Store User Data Source (936*****83c): external_ids.0.id: '' expected type 'bool', got unconvertible type 'string', value: 'b29******94'
  with data.aws_identitystore_user.users["name.surname@example.com"],
  on data.tf line 5, in data "aws_identitystore_user" "users":
   5: data "aws_identitystore_user" "users" {

Terraform Configuration Files

[Container] 2022/10/07 08:50:50 Running command bash adf-build/helpers/terraform/adf_terraform.sh $TF_STAGE
Terraform v1.0.0
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.3.2. You can update by downloading from https://www.terraform.io/downloads.html
Terraform stage: plan
List of target regions: eu-west-1
List of target account: ****
Running terraform plan on account **** and region eu-west-1
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 4.0.0"...
- Installing hashicorp/aws v4.34.0...
- Installed hashicorp/aws v4.34.0 (signed by HashiCorp)

Steps to Reproduce

  • have AWS SSO
  • have an external IDP (Azure)
  • assegnate user to specific account and permission set

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

@AngeloGelmini AngeloGelmini added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Oct 7, 2022
@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/identitystore Issues and PRs that pertain to the identitystore service. service/ssoadmin Issues and PRs that pertain to the ssoadmin service. labels Oct 7, 2022
@bschaatsbergen
Copy link
Member

Prepping a fix for this.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Oct 10, 2022
@ewbankkit
Copy link
Contributor

Similar: #27145.

@github-actions github-actions bot added this to the v4.35.0 milestone Oct 10, 2022
@github-actions
Copy link

This functionality has been released in v4.35.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

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 17, 2022
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/identitystore Issues and PRs that pertain to the identitystore service. service/ssoadmin Issues and PRs that pertain to the ssoadmin service.
Projects
None yet
3 participants