Search code examples
amazon-web-servicesterraformamazon-cognito

how to change id pool in cognito terraform


I deleted a pool manually in cognito (aws) and terraform has a relation with the pool deleted so it says:

reading Amazon Cognito IDP (Identity Provider) User (xxxx): ResourceNotFoundException: User pool ********_xxxxxxxxx does not exist.

is it posible to create a new pool with a custom id in order to match the deleted one? or there is a trick to make in terraform to avoid the error?

I tried to set a custom id in aws but i dont find the option


Solution

  • It's not possible to set a custom ID, but for fix the terraform error you can remove from the state the Cognito IDP with

    terraform state rm ADDRESS
    

    and after that or you'll recreate it with terraform or if you done by hand you can import it into the state with

    terraform import aws_cognito_identity_provider.example us-west-2_abc123:CorpAD
    

    as reported in documentation