terraform/builtin/providers
Paul Stack de6b51f8f9 provider/aws: Refresh aws_autoscaling_schedule from state on 404 (#9659)
Fixes #9654

Before the fix, I created an ASG with a schedule on it. Went to the AWS
console and deleted the schedule. A terraform plan looked as follows:

```
% terraform plan
    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:
    terraform-test-foobar5)
    aws_autoscaling_group.foobar: Refreshing state... (ID:
    terraform-test-foobar5)
    aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar)
    Error refreshing state: 1 error(s) occurred:

    * aws_autoscaling_schedule.foobar: Unable to find Autoscaling
    * Scheduled Action: []*autoscaling.ScheduledUpdateGroupAction(nil)
```

After the fix:

```
terraform plan                                                                                                                           1 ↵
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: terraform-test-foobar5)
aws_autoscaling_group.foobar: Refreshing state... (ID: terraform-test-foobar5)
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_schedule.foobar
    arn:                    "<computed>"
    autoscaling_group_name: "terraform-test-foobar5"
    desired_capacity:       "0"
    end_time:               "2018-01-16T13:00:00Z"
    max_size:               "0"
    min_size:               "0"
    recurrence:             "<computed>"
    scheduled_action_name:  "foobar"
    start_time:             "2018-01-16T07:00:00Z"

Plan: 1 to add, 0 to change, 0 to destroy.
```

Tests run as expected:

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAutoscalingSchedule_'                                               2 ↵ ✹
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/10/27 17:45:19 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAutoscalingSchedule_ -timeout 120m
=== RUN   TestAccAWSAutoscalingSchedule_basic
--- PASS: TestAccAWSAutoscalingSchedule_basic (140.94s)
=== RUN   TestAccAWSAutoscalingSchedule_disappears
--- PASS: TestAccAWSAutoscalingSchedule_disappears (179.17s)
=== RUN   TestAccAWSAutoscalingSchedule_recurrence
--- PASS: TestAccAWSAutoscalingSchedule_recurrence (186.72s)
=== RUN   TestAccAWSAutoscalingSchedule_zeroValues
--- PASS: TestAccAWSAutoscalingSchedule_zeroValues (167.73s)
PASS
ok	github.com/hashicorp/terraform/builtin/providers/aws	674.530s
```
2016-10-27 18:39:15 +01:00
..
archive provider/archive: Converting to datasource. (#8492) 2016-10-25 15:59:06 +01:00
atlas
aws provider/aws: Refresh aws_autoscaling_schedule from state on 404 (#9659) 2016-10-27 18:39:15 +01:00
azure
azurerm provider/azurerm: Fix VHD deletion when VM and Storage account are in separate resource groups (#9631) 2016-10-27 16:42:47 +01:00
bitbucket provider/bitbucket: Remove unnecessary casts. 2016-09-22 17:35:03 +10:00
chef
clc
cloudflare
cloudstack provider/cloudstack: enhance security groups and rules (#9645) 2016-10-27 11:10:15 +02:00
cobbler
consul Fixes for consul_service resource (#9366) 2016-10-26 13:07:00 +01:00
datadog provider/datadog: Reduce diff on thresholds 2016-10-20 10:22:24 -05:00
digitalocean provider/digitalocean: Ingore resize_disk on the import DO droplet tests 2016-10-25 11:40:56 +01:00
dme
dnsimple
docker provider/docker: Fixes for docker_container host object and documentation (#9367) 2016-10-27 10:54:05 +01:00
dyn
fastly
github provider/github: github_repository resource 2016-10-13 08:04:17 -07:00
google Merge pull request #9442 from obsh/google-scope-aliases 2016-10-24 14:36:51 +01:00
grafana
heroku
influxdb
librato provider/librato: Randomize the test case names as dangling resources were causing failures 2016-09-22 12:43:06 +01:00
logentries
mailgun
mysql
null
openstack Merge pull request #9617 from jtopjian/openstack-fwaas-proto-any 2016-10-26 12:56:11 -06:00
packet
pagerduty Remove the unnecessary use of &schema.Schema 2016-10-24 16:43:53 +02:00
postgresql
powerdns
rabbitmq Fix vet issues 2016-10-18 11:11:12 -04:00
random
rundeck
scaleway provider/scaleway: fix scaleway_volume_attachment with count > 1 (#9493) 2016-10-27 16:51:34 +01:00
softlayer
statuscake
template
terraform
test
tls Restore tls_cert_request to being a managed resource 2016-09-24 12:22:07 -07:00
triton
ultradns
vcd
vsphere Adding 'detach_unknown_disks_on_delete' flag for VM resource 2016-09-26 18:16:02 -07:00