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

Implement graceful shutdown for helper/resource waiter #73

Closed
radeksimko opened this issue Jan 23, 2017 · 4 comments · Fixed by #322
Closed

Implement graceful shutdown for helper/resource waiter #73

radeksimko opened this issue Jan 23, 2017 · 4 comments · Fixed by #322
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@radeksimko
Copy link
Member

For many resources it's currently impossible for Terraform to gracefully stop the execution mid-flight as helper/resource.StateChangeConf is not cancellable from above the resource/provider.

Mitchell has done the initial work in hashicorp/terraform#9536 (also includes changes in Azure provider + 1 resource). The goal is to make similar changes to (most) other providers - at least the ones we know leverage helper/resource.StateChangeConf and pass the StopContext down to the resource.StateChangeConf in the resource code.

Terraform Version

v0.8.5-dev (aa3eda76425a0b936192c6e95e45758e2727ba4b)

Affected Resource(s)

  • any resource using resource.StateChangeConf, but mainly ones that have long timeouts, e.g. AWS RDS, AWS Elasticsearch Domain

Terraform Configuration Files

resource "aws_rds_cluster" "default" {
  cluster_identifier = "aurora-cluster-demo"
  availability_zones = ["eu-west-2a","eu-west-2b"]
  database_name = "mydb"
  master_username = "foo"
  master_password = "barbarbar"
  backup_retention_period = 5
  preferred_backup_window = "07:00-09:00"
}

Expected Behavior

aws_rds_cluster.default: Creating...
...
aws_rds_cluster.default: Still creating... (10s elapsed)
^CInterrupt received. Gracefully shutting down...
Apply failed. Interruption received, partial state saved.

Actual Behavior

aws_rds_cluster.default: Creating...
...
aws_rds_cluster.default: Still creating... (10s elapsed)
^CInterrupt received. Gracefully shutting down...
aws_rds_cluster.default: Still creating... (20s elapsed)
aws_rds_cluster.default: Still creating... (30s elapsed)
aws_rds_cluster.default: Still creating... (40s elapsed)
aws_rds_cluster.default: Still creating... (50s elapsed)
aws_rds_cluster.default: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Steps to Reproduce

  1. terraform apply
  2. Ctrl+C (once)

References

@sheerun
Copy link

sheerun commented Apr 21, 2018

Just like @radeksimko noticed it would best to put StopContext into schema.ResourceData as it is the easiest place to access it when implementing CRUD actions in providers.

@hashibot hashibot transferred this issue from hashicorp/terraform Sep 26, 2019
@hashibot hashibot added the enhancement New feature or request label Oct 2, 2019
@paultyng
Copy link
Contributor

Should investigate this as part of #276

@paultyng
Copy link
Contributor

context.Context support was just merged in to our v2 branch and will be included in that release.

@ghost
Copy link

ghost commented Mar 15, 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 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.

@ghost ghost locked and limited conversation to collaborators Mar 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants