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

Cognito domain doesn't delete during destroy #5313

Closed
sciencey-sanjay opened this issue Jul 24, 2018 · 18 comments · Fixed by #14732
Closed

Cognito domain doesn't delete during destroy #5313

sciencey-sanjay opened this issue Jul 24, 2018 · 18 comments · Fixed by #14732
Labels
bug Addresses a defect in current functionality.
Milestone

Comments

@sciencey-sanjay
Copy link

sciencey-sanjay commented Jul 24, 2018

Terraform Version

Terraform v0.10.8
AWS provider 1.21.0

Affected Resource(s)

aws_cognito_user_pool_domain

Terraform Configuration Files

Below is an excerpt from terraform file to create aws_cognito_user_pool_domain .

# Pool domain
resource "aws_cognito_user_pool_domain" "domain" {
  domain       = "${var.userpooldomain}"
  user_pool_id = "${aws_cognito_user_pool.pool.id}"
}

Debug Output

Panic Output

Expected Behavior

domain should be deleted by terraform apply, when the resource is marked for destroy.

Actual Behavior

Domain isn't deleted and throws error message

aws_cognito_user_pool_domain.domain: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, DeleteUserPoolDomainInput.UserPoolId.

Steps to Reproduce

  1. Change the module name
  2. Run terraform plan and apply(Module name is changed and existing pool is deleted and a new user pool(with new name) is created.
  3. Modify any change for the new user pool
  4. terraform plan
  5. terraform apply
@bflad bflad added bug Addresses a defect in current functionality. service/cognito labels Jul 24, 2018
@gurunathsane
Copy link

I am facing the Same issue. Any Updates on this?

@B2-DevOps
Copy link

any updates on this? facing this same issue

@ghost
Copy link

ghost commented Nov 7, 2018

+1

@smartinspereira
Copy link

+1
for now i solved this using a custom script, leveraging the aws cli, to delete the domain, on destroy and update.

@rburke789
Copy link

+1

Any updates on this issue? I am seeing the same behavior

@prashantrai
Copy link

prashantrai commented Feb 6, 2019

Is there any update on this. I'm facing the similar issue,

  • module.use1.aws_cognito_user_pool_domain.my_cognito_user_pool_domain (destroy): 1 error(s) occurred:

aws_cognito_user_pool_domain.domain: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, DeleteUserPoolDomainInput.UserPoolId.

@hobti01
Copy link

hobti01 commented Feb 23, 2019

I'm seeing this issue with the following versions. Would be great to have a fix, workaround or status.

Terraform v0.11.11
+ provider.aws v1.60.0

@michalschott
Copy link
Contributor

have anyone checked if this is still the case in provider.aws ~> 2.0 ?

@tomasaschan
Copy link

I see this today.

λ terraform -v
Terraform v0.12.5
+ provider.aws v2.23.0

@haruharuharuby
Copy link

I saw same issue. I fix this my work around.

  • terraform refresh
  • remove "aws_cognito_user_pool_domain" block in .tfstate
  • terraform apply

this is my environment
-> % terraform version
Terraform v0.11.13

  • provider.aws v2.41.0

@eschwartz
Copy link

eschwartz commented Jan 6, 2020

Similar workaround here as @haruharuharuby , but I'd recommend using the terraform state rm command, rather than manually messing with your state file directly.

eg.

terraform state rm aws_cognito_user_pool_domain.my_domain

For the record, I'm using TF v0.12.8, and aws provider v2.43.0

@oceanlewis
Copy link

Ran into this issue today. The solution of removing the domain from the state after deleting the domain manually worked. Just adding my two cents to hopefully get this fixed.

@mkielar
Copy link
Contributor

mkielar commented Jun 19, 2020

The error is still there in:

→ terraform version
Terraform v0.12.20
+ provider.aws v2.61.0

I tried working around this with local-exec destroy-time provisioned and deleting the domain manualy, but it seems the problem is with terraform leaving some garbage information (namely: domain state, but without user_pool_id) in the statefile. This is why we see the:

minimum field size of 1, DeleteUserPoolDomainInput.UserPoolId.

error, and this is why terraform is unable to properly pass user_pool_id to the provisioner too.

@YoniMataraso
Copy link

I have the same issue

@DrFaust92
Copy link
Collaborator

opened #14732 to address this.

@bflad bflad added this to the v3.3.0 milestone Aug 19, 2020
@bflad
Copy link
Member

bflad commented Aug 19, 2020

Hi folks 👋 A fix for a typical cause of this issue has been merged and will release with version 3.3.0 of the Terraform AWS Provider, likely tomorrow. Thanks to @DrFaust92 for the implementation. 👍

Please note that there may be other causes of this issue still present and if so, please file a new bug report after trying the upgrade when its released.

@ghost
Copy link

ghost commented Aug 20, 2020

This has been released in version 3.3.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!

@ghost
Copy link

ghost commented Sep 18, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 18, 2020
@DrFaust92 DrFaust92 removed their assignment Mar 26, 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.
Projects
None yet