Skip to content

SIGINT ("graceful shutdown") is unacceptably slow / doesn't always work #141

Closed
@jcmcken

Description

@jcmcken

Terraform Version

Terraform v0.11.11

Terraform Configuration Files

Any AWS-based configuration will do. (Actually, any Terraform resource that reaches out to remote network endpoints would be fine).

Expected Behavior

Our environment requires talking through a corporate HTTP proxy to reach AWS API endpoints. If I fail to set this proxy and and issue a terraform apply, Terraform spins and spins, retrying the API calls, which is expected. However in this case I want to send a SIGINT via Ctrl + C to cancel the apply so I can set the proxy. I expect this graceful shutdown to be quick, since under no circumstance will the apply work, no matter how many times it retries.

Actual Behavior

When I Ctrl + C, however, Terraform claims that it's gracefully shutting down, but really doesn't seem to do anything. The 'apply' command continues for minutes and minutes retrying the resource (at some point I just give up and force quit, but maybe it times out after awhile).

Here's some output:

module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (9m30s elapsed)
^CInterrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...
stopping operation...
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (9m40s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (9m50s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m0s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m10s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m20s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m30s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m40s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (10m50s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m0s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m10s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m20s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m30s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m40s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (11m50s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m0s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m10s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m20s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m30s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m40s elapsed)
module.postgresql-log-subscription.aws_cloudwatch_log_group.default: Still creating... (12m50s elapsed)

(This goes on for several more minutes before I Ctrl +C again and force quit)

Steps to Reproduce

Unsure of the exact steps, but the general steps are:

  1. Configure your local machine to block outbound access to AWS.
  2. Run a terraform apply using AWS resources.
  3. Observe that Terraform retries the API calls over and over.
  4. Hit Ctrl + C or otherwise send a SIGINT to the Terraform process.
  5. Observe that Terraform doesn't actually gracefully shutdown.

Additional Context

The only non-standard setting is use of TF_PLUGIN_CACHE_DIR environment variable to set a global plugin cache in my home directory (so that each module doesn't need to re-download every module)

I don't expect this has any relevance to my problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions