-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
provider/aws: Refresh aws_autoscaling_schedule from state when autoscaling_group not found #12312
Conversation
…aling_group not found Fixes: #12279 When manually deleting an autoscaling_group from the console, a terraform plan would look as follows: ``` % terraform plan Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) Error refreshing state: 1 error(s) occurred: * aws_autoscaling_schedule.foobar: aws_autoscaling_schedule.foobar: Error retrieving Autoscaling Scheduled Actions: ValidationError: Group test not found status code: 400, request id: 093e9ed5-fe01-11e6-b990-1f64334b3a10 ``` After this patch: ``` % terraform plan ✹ ✭ [WARN] /Users/stacko/Code/go/bin/terraform-provider-aws overrides an internal plugin for aws-provider. If you did not expect to see this message you will need to remove the old plugin. See https://www.terraform.io/docs/internals/internal-plugins.html Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) The Terraform execution plan has been generated and is shown below. Resources are shown in alphabetical order for quick scanning. Green resources will be created (or destroyed and then created if an existing resource exists), yellow resources are being changed in-place, and red resources will be destroyed. Cyan entries are data sources to be read. Note: You didn't specify an "-out" parameter to save this plan, so when "apply" is called, Terraform can't guarantee this is what will execute. + aws_autoscaling_group.foobar arn: "<computed>" availability_zones.#: "1" availability_zones.2487133097: "us-west-2a" default_cooldown: "<computed>" desired_capacity: "<computed>" force_delete: "true" health_check_grace_period: "300" health_check_type: "ELB" launch_configuration: "test-0096cf26c7eebdc9fcb5bd1837" load_balancers.#: "<computed>" max_size: "1" metrics_granularity: "1Minute" min_size: "1" name: "test" protect_from_scale_in: "false" tag.#: "1" tag.157008572.key: "Foo" tag.157008572.propagate_at_launch: "true" tag.157008572.value: "foo-bar" termination_policies.#: "1" termination_policies.0: "OldestInstance" vpc_zone_identifier.#: "<computed>" wait_for_capacity_timeout: "10m" + aws_autoscaling_schedule.foobar arn: "<computed>" autoscaling_group_name: "test" desired_capacity: "0" end_time: "2017-12-12T06:00:00Z" max_size: "1" min_size: "0" recurrence: "<computed>" scheduled_action_name: "foobar" start_time: "2017-12-11T18:00:00Z" Plan: 2 to add, 0 to change, 0 to destroy. ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…aling_group (#12312) not found Fixes: #12279 When manually deleting an autoscaling_group from the console, a terraform plan would look as follows: ``` % terraform plan Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) Error refreshing state: 1 error(s) occurred: * aws_autoscaling_schedule.foobar: aws_autoscaling_schedule.foobar: Error retrieving Autoscaling Scheduled Actions: ValidationError: Group test not found status code: 400, request id: 093e9ed5-fe01-11e6-b990-1f64334b3a10 ``` After this patch: ``` % terraform plan ✹ ✭ [WARN] /Users/stacko/Code/go/bin/terraform-provider-aws overrides an internal plugin for aws-provider. If you did not expect to see this message you will need to remove the old plugin. See https://www.terraform.io/docs/internals/internal-plugins.html Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) The Terraform execution plan has been generated and is shown below. Resources are shown in alphabetical order for quick scanning. Green resources will be created (or destroyed and then created if an existing resource exists), yellow resources are being changed in-place, and red resources will be destroyed. Cyan entries are data sources to be read. Note: You didn't specify an "-out" parameter to save this plan, so when "apply" is called, Terraform can't guarantee this is what will execute. + aws_autoscaling_group.foobar arn: "<computed>" availability_zones.#: "1" availability_zones.2487133097: "us-west-2a" default_cooldown: "<computed>" desired_capacity: "<computed>" force_delete: "true" health_check_grace_period: "300" health_check_type: "ELB" launch_configuration: "test-0096cf26c7eebdc9fcb5bd1837" load_balancers.#: "<computed>" max_size: "1" metrics_granularity: "1Minute" min_size: "1" name: "test" protect_from_scale_in: "false" tag.#: "1" tag.157008572.key: "Foo" tag.157008572.propagate_at_launch: "true" tag.157008572.value: "foo-bar" termination_policies.#: "1" termination_policies.0: "OldestInstance" vpc_zone_identifier.#: "<computed>" wait_for_capacity_timeout: "10m" + aws_autoscaling_schedule.foobar arn: "<computed>" autoscaling_group_name: "test" desired_capacity: "0" end_time: "2017-12-12T06:00:00Z" max_size: "1" min_size: "0" recurrence: "<computed>" scheduled_action_name: "foobar" start_time: "2017-12-11T18:00:00Z" Plan: 2 to add, 0 to change, 0 to destroy. ```
…aling_group (hashicorp#12312) not found Fixes: hashicorp#12279 When manually deleting an autoscaling_group from the console, a terraform plan would look as follows: ``` % terraform plan Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) Error refreshing state: 1 error(s) occurred: * aws_autoscaling_schedule.foobar: aws_autoscaling_schedule.foobar: Error retrieving Autoscaling Scheduled Actions: ValidationError: Group test not found status code: 400, request id: 093e9ed5-fe01-11e6-b990-1f64334b3a10 ``` After this patch: ``` % terraform plan ✹ ✭ [WARN] /Users/stacko/Code/go/bin/terraform-provider-aws overrides an internal plugin for aws-provider. If you did not expect to see this message you will need to remove the old plugin. See https://www.terraform.io/docs/internals/internal-plugins.html Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837) aws_autoscaling_group.foobar: Refreshing state... (ID: test) aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar) The Terraform execution plan has been generated and is shown below. Resources are shown in alphabetical order for quick scanning. Green resources will be created (or destroyed and then created if an existing resource exists), yellow resources are being changed in-place, and red resources will be destroyed. Cyan entries are data sources to be read. Note: You didn't specify an "-out" parameter to save this plan, so when "apply" is called, Terraform can't guarantee this is what will execute. + aws_autoscaling_group.foobar arn: "<computed>" availability_zones.#: "1" availability_zones.2487133097: "us-west-2a" default_cooldown: "<computed>" desired_capacity: "<computed>" force_delete: "true" health_check_grace_period: "300" health_check_type: "ELB" launch_configuration: "test-0096cf26c7eebdc9fcb5bd1837" load_balancers.#: "<computed>" max_size: "1" metrics_granularity: "1Minute" min_size: "1" name: "test" protect_from_scale_in: "false" tag.#: "1" tag.157008572.key: "Foo" tag.157008572.propagate_at_launch: "true" tag.157008572.value: "foo-bar" termination_policies.#: "1" termination_policies.0: "OldestInstance" vpc_zone_identifier.#: "<computed>" wait_for_capacity_timeout: "10m" + aws_autoscaling_schedule.foobar arn: "<computed>" autoscaling_group_name: "test" desired_capacity: "0" end_time: "2017-12-12T06:00:00Z" max_size: "1" min_size: "0" recurrence: "<computed>" scheduled_action_name: "foobar" start_time: "2017-12-11T18:00:00Z" Plan: 2 to add, 0 to change, 0 to destroy. ```
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. |
Fixes: #12279
When manually deleting an autoscaling_group from the console, a
terraform plan would look as follows:
After this patch: