-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Cannot remove function + attached resolver #15480
Comments
I guess this is more an aws issue than a terraform one (see: aws/aws-appsync-community#146) |
Is it something new according this issue? We have a same error msg., when TF apply, then rename some function, which is linked to resolver and then TF apply again. tested on TF 1.3.4 with aws prov. 4.38.0, 1.3.7 with 4.49.0 and alpha1.4.0 20221207 with 4.49.0, still the same error |
I encountered a similar issue when changing a function data source and removing the previous referenced datasource in the same apply. Error: deleting Appsync Data Source (widgsvnwtrddjihrjcvgsdfz4y-http_call): operation error AppSync: DeleteDataSource, https response error StatusCode: 400, RequestID: d5a1f331-e48f-47e2-9416-f32719315436, BadRequestException: Data source is still in use by functions: [lknmme342nbd7iy33xz4xkpld4] Example:
To fix this, I added the create_before_destroy lifecycle argument so that the function is updated before dependent resources are destroyed |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.12.28
AWS provider v2.70.0
Affected Resource(s)
Description
Terraform correctly creates above resources and sets up implicit dependency from resolver to function, when pipeline_config is created. However due to AWS limitations of this relation, destroying those two resources at same run/deployment is resulting in a failure.
Before there are comments of 'did you try on 0.13' - no I haven't, that's a luxury I can't afford at this moment as infrastructure that I'm working on is big and mature, we have upgrade in roadmap but not anytime soon.
I'm looking for a solution or a workaround that will solve this, or at least will be solved once we upgrade.
Terraform Configuration Files
Note: incomplete and dummy part of code, but should give an idea of a problem
Panic Output
Error: Error deleting AppSync Function .....: BadRequestException: Cannot delete a function which is currently used by a resolver. Resolver type: Query, field: ....
Error: BadRequestException: Data source is still in use by functions: [....]
Expected Behavior
There has to be reversed dependency when it comes to destroying/updating. Resolver MUST be updated/removed before function, this is AWS requirement.
On creation however it stays as it is right now, function has to be created before it is attached to resolver.
Actual Behavior
Because of implicit dependency, on destroy function is deleted first, and it can't as it's attached to resolver configuration. Adding explicit dependency results in cycle error.
Steps to Reproduce
Create any resolver and function in pipeline_config setup, then remove them from hcl code and run terraform to destroy them.
The text was updated successfully, but these errors were encountered: