aws-ia / terraform-aws-iam-identity-center

Apache License 2.0
31 stars 9 forks source link

importing existing account assignment #42

Open rfum opened 3 months ago

rfum commented 3 months ago

Hello, I'm willing to import my existing account assignment resources by using import block as defined in https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_account_assignment#import . When I check the resources section in the module I see that there's aws_ssoadmin_account_assignment.account_assignment resource is listed. My module configuration is like below:

module "aws_iam_identity_center" {
  source  = "aws-ia/iam-identity-center/aws"
  version = "0.0.5"
  providers = {
    aws = aws
  }
}

My import statement is like below:

import {
  to = module.aws_iam_identity_center.aws_ssoadmin_account_assignment.account_assignment
  id = "f81d4fae-7dec-11d0-a765-00a0c91e6bf6,GROUP,1234567890,AWS_ACCOUNT,arn:aws:sso:::permissionSet/ssoins-0123456789abcdef/ps-0123456789abcdef,arn:aws:sso:::instance/ssoins-0123456789abcdef"
}

I'm getting the following error :

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Configuration for import target does not exist
│ 
│ The configuration for the given import
│ module.aws_iam_identity_center.aws_ssoadmin_account_assignment.account_assignment
│ does not exist. All target instances must have an associated configuration
│ to be imported.

does importing possible with this module? am I doing something wrong in my configuration?

umerbeigh commented 2 months ago

is there a way to migrate iam users to identity center.. i am currently using i am to manage users and groups .. i want to migrate to identity center? Does this module support importing iam users .

novekm commented 2 months ago

Hi all, sorry for the delay. Responses below:

rfum commented 2 months ago

@novekm I'm using a 3rd party IdP so users and groups are already present. What I need to do is just to import account assignments if I understand correctly. I also considered for_each block by myself, but it's a bit confusing for me. I already have some assignments but I couldn't form up a for_each loop for them because of the error: "resource name account_assignment is not found". When I checked the source code of the module the naming matching with my code. What might be the reason behind this?