Go to file
Paddy 127283a858 provider/google: detach disks before deleting them.
When a `google_compute_disk` is attached to a `google_compute_instance`,
deleting can be tricky. GCP doesn't allow disks that are attached to
instances to be deleted. Normally, this is fine; the instance depends on
the disk, so by the time the disk is deleted, the instance should
already be gone.

However, some reports have cropped up (#8667) that deleting disks is
failing because they're still attached to instances. Though this
shouldn't happen, it appears it can happen under some unknown
conditions.

This PR adds logic that will attempt to detach disks from any instances
they're attached to before deleting the disks, adding another safeguard
that should prevent this behaviour.
2017-05-18 17:28:16 -07:00
test-fixtures provider/google: self-signed ssl certs for testing 2015-11-20 11:32:25 -05:00
compute_operation.go use v1 apis instead of beta 2016-12-01 12:27:33 -08:00
config_test.go provider/google: read credentials as contents instead of path 2015-11-16 15:14:32 -06:00
config.go provider/google: Log HTTP requests and responses in DEBUG mode (#14281) 2017-05-10 21:16:43 +02:00
container_operation.go provider/google: initial commit for node pool resource (#11802) 2017-03-06 14:59:24 -08:00
data_source_google_compute_network_test.go provider/google: randomize network data source test name. 2017-04-27 08:52:02 -07:00
data_source_google_compute_network.go provider/google: datasource subnetwork and network (#12442) 2017-04-13 13:25:29 -07:00
data_source_google_compute_subnetwork_test.go provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
data_source_google_compute_subnetwork.go provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
data_source_google_compute_zones_test.go provider/google: Add google_compute_zones data source 2017-02-15 09:50:25 +00:00
data_source_google_compute_zones.go provider/google: Add google_compute_zones data source 2017-02-15 09:50:25 +00:00
data_source_google_container_engine_versions_test.go Update test names. 2017-05-10 15:12:14 -07:00
data_source_google_container_engine_versions.go google_container_versions => google_container_engine_versions 2017-05-10 15:01:15 -07:00
data_source_google_iam_policy.go providers/google: Add documentation for google_iam_policy resource 2016-09-07 13:35:33 -07:00
disk_type.go Update Google API import to point to the new location. 2015-03-18 17:10:39 +00:00
dns_change.go provider/google: atomic Cloud DNS record changes (#6575) 2016-08-08 12:36:27 +12:00
image_test.go provider/google: update image resolution code. 2017-02-23 21:55:30 -08:00
image.go Update typo. 2017-03-13 22:04:08 -07:00
import_bigquery_dataset_test.go provider/google: BigQuery Dataset (#13436) 2017-04-20 09:47:38 -07:00
import_bigquery_table_test.go provider/google: BigQuery Table (#13743) 2017-05-10 10:20:39 -07:00
import_compute_address_test.go Google Compute Address Importability 2017-04-01 13:22:39 -04:00
import_compute_autoscaler_test.go provider/google: Support Import of 'google_compute_autoscaler' 2016-08-10 16:19:31 -04:00
import_compute_firewall_test.go provider/google: Support Import of 'google_compute_firewall' 2016-08-16 17:04:30 -04:00
import_compute_forwarding_rule_test.go provider/google: Support Import of 'google_compute_forwarding_rule' 2016-08-10 16:45:56 -04:00
import_compute_global_address_test.go Importability for Google Compute Global Address 2017-04-01 13:25:34 -04:00
import_compute_http_health_check_test.go provider/google: Support Import of 'google_resource_http_health_check' 2016-08-10 16:30:41 -04:00
import_compute_instance_group_manager_test.go provider/google: Support Import of'google_compute_instance_group_manager' 2016-08-18 15:13:52 -04:00
import_compute_instance_template_test.go provider/google: Support Import of 'google_compute_instance_template' 2016-08-15 10:03:31 -04:00
import_compute_network_test.go Adding Import to the Google network resource 2017-04-21 01:58:22 +00:00
import_compute_route_test.go provider/google: Minor formatting issues on import of compute route test 2017-05-04 19:17:25 +03:00
import_compute_target_pool_test.go provider/google: Support Import of 'google_compute_target_pool' 2016-08-11 10:24:03 -04:00
import_dns_managed_zone_test.go Importability for Google DNS Managed Zone 2017-05-01 20:28:28 -04:00
import_google_project_test.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
metadata.go provider/google: Fix project metadata sshkeys from showing up 2016-01-05 11:37:52 -05:00
provider_test.go provider/google: Moving the XPN EnvVar check into provider_test.go to stop failed build 2016-12-13 19:29:23 +00:00
provider.go Merge pull request #14280 from hashicorp/paddy_container_versions 2017-05-10 15:50:16 -07:00
resource_bigquery_dataset_test.go provider/google: BigQuery Dataset (#13436) 2017-04-20 09:47:38 -07:00
resource_bigquery_dataset.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_bigquery_table_test.go provider/google: BigQuery Table (#13743) 2017-05-10 10:20:39 -07:00
resource_bigquery_table.go provider/google: BigQuery Table (#13743) 2017-05-10 10:20:39 -07:00
resource_compute_address_test.go provider/google: remove conflicting names from acceptance tests 2016-01-05 16:57:24 -05:00
resource_compute_address.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_autoscaler_test.go Fix acceptance test image reversion (#8349) 2016-08-25 14:39:03 +01:00
resource_compute_autoscaler.go provider/google: Update Google Compute godep 2017-05-02 23:08:23 +02:00
resource_compute_backend_bucket_test.go provider/google: Add support for backend buckets 2017-05-02 23:18:40 +02:00
resource_compute_backend_bucket.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_backend_service_test.go provider/google: Improve error messages in backend_service test 2017-05-02 23:18:41 +02:00
resource_compute_backend_service.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_disk_test.go provider/google: detach disks before deleting them. 2017-05-18 17:28:16 -07:00
resource_compute_disk.go provider/google: detach disks before deleting them. 2017-05-18 17:28:16 -07:00
resource_compute_firewall_migrate_test.go provider/google: Support Import of 'google_compute_firewall' 2016-08-16 17:04:30 -04:00
resource_compute_firewall_migrate.go provider/google: Support Import of 'google_compute_firewall' 2016-08-16 17:04:30 -04:00
resource_compute_firewall_test.go provider/google: Support Import of 'google_compute_firewall' 2016-08-16 17:04:30 -04:00
resource_compute_firewall.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_forwarding_rule_test.go provider/google: fix single port diff cycle 2017-03-13 17:03:20 -07:00
resource_compute_forwarding_rule.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_global_address_test.go provider/google: remove conflicting names from acceptance tests 2016-01-05 16:57:24 -05:00
resource_compute_global_address.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_global_forwarding_rule_test.go provider/google: limit hardcoded test resource names 2016-01-05 19:49:06 -05:00
resource_compute_global_forwarding_rule.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_health_check_test.go use conflictswith for health check instead of separate type field 2016-12-08 13:35:57 -08:00
resource_compute_health_check.go provider/google: Fix the health check default values for http and https so they match the expected value in the documentation and specific health check instances. (#14441) 2017-05-15 12:59:44 -07:00
resource_compute_http_health_check_test.go provider/google: remove conflicting names from acceptance tests 2016-01-05 16:57:24 -05:00
resource_compute_http_health_check.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_https_health_check_test.go provider/google: remove conflicting names from acceptance tests 2016-01-05 16:57:24 -05:00
resource_compute_https_health_check.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_image_test.go Added create timeout for compute images and instances 2016-11-12 18:30:02 -08:00
resource_compute_image.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_instance_group_manager_test.go provider/google: allow instance group managers in region other than project (#11294) 2017-01-30 11:35:35 +00:00
resource_compute_instance_group_manager.go provider/google: Move 404 checking into a function in provider.go, call it from instance and IGM (#14190) 2017-05-04 16:15:36 -07:00
resource_compute_instance_group_migrate_test.go provider/google: turn compute_instance_group.instances into a set (#12790) 2017-03-22 17:47:41 -07:00
resource_compute_instance_group_migrate.go provider/google: turn compute_instance_group.instances into a set (#12790) 2017-03-22 17:47:41 -07:00
resource_compute_instance_group_test.go provider/google: turn compute_instance_group.instances into a set (#12790) 2017-03-22 17:47:41 -07:00
resource_compute_instance_group.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_instance_migrate_test.go Remove create_timeout backwards incompatibilities. 2016-12-19 23:49:53 -08:00
resource_compute_instance_migrate.go Remove create_timeout backwards incompatibilities. 2016-12-19 23:49:53 -08:00
resource_compute_instance_template_test.go provider/google: add support for networkIP in compute instance templates (#13515) 2017-05-01 17:16:05 -07:00
resource_compute_instance_template.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_instance_test.go provider/google: add attached_disk field to google_compute_instance (#13443) 2017-04-25 13:20:02 -07:00
resource_compute_instance.go provider/google: Move 404 checking into a function in provider.go, call it from instance and IGM (#14190) 2017-05-04 16:15:36 -07:00
resource_compute_network_test.go Add subnetwork resource ACC tests, additional doc updates 2016-02-18 08:37:58 -08:00
resource_compute_network.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_project_metadata_test.go Fix both Radek & Dana's comments. 2017-04-27 11:39:13 -07:00
resource_compute_project_metadata.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_region_backend_service_test.go Add support for session_affinity to google_compute_region_backend_service 2017-01-17 16:32:58 -08:00
resource_compute_region_backend_service.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_route_test.go Add support for default-internet-gateway alias for google_compute_route (#9676) 2016-11-01 13:45:36 +00:00
resource_compute_route.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_snapshot_test.go Corrected test for snapshot. Simplified tests. Added a new test for source_disk_link 2017-04-20 12:13:17 +02:00
resource_compute_snapshot.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_ssl_certificate_test.go Add support for name_prefix to google_compute_ssl_certificate 2016-12-12 15:57:58 -08:00
resource_compute_ssl_certificate.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_subnetwork_test.go provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
resource_compute_subnetwork.go provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
resource_compute_target_http_proxy_test.go provider/google: limit hardcoded test resource names 2016-01-05 19:49:06 -05:00
resource_compute_target_http_proxy.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_target_https_proxy_test.go provider/google: remove conflicting names from acceptance tests 2016-01-05 16:57:24 -05:00
resource_compute_target_https_proxy.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_target_pool_test.go Use healthcheck names instead of urls when reading target pool 2016-08-26 10:45:59 -07:00
resource_compute_target_pool.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_url_map_test.go provider/google: fix url map test and update logic (#12317) 2017-03-01 09:47:12 +00:00
resource_compute_url_map.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_vpn_gateway_test.go Make network attribute more consistent. 2016-09-05 08:02:54 +12:00
resource_compute_vpn_gateway.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_compute_vpn_tunnel_test.go provider/google: make local_traffic_selector computed now that we read it back from server 2017-02-15 19:48:44 +01:00
resource_compute_vpn_tunnel.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_container_cluster_test.go google_container_versions => google_container_engine_versions 2017-05-10 15:01:15 -07:00
resource_container_cluster.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_container_node_pool_test.go provider/google: initial commit for node pool resource (#11802) 2017-03-06 14:59:24 -08:00
resource_container_node_pool.go provider/google: initial commit for node pool resource (#11802) 2017-03-06 14:59:24 -08:00
resource_dns_managed_zone_test.go provider/google: update DNS names in tests. 2017-02-08 10:24:04 -08:00
resource_dns_managed_zone.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_dns_record_set_test.go provider/google: update DNS names in tests. 2017-02-08 10:24:04 -08:00
resource_dns_record_set.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_google_project_iam_policy_test.go Fix variable indents. 2017-03-13 23:23:32 -07:00
resource_google_project_iam_policy.go provider/google: ignore expanded v collapsed policies in diff 2017-03-02 14:00:45 -08:00
resource_google_project_migrate_test.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
resource_google_project_migrate.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
resource_google_project_services_test.go update list of services in ignoreUnenablableServices test (#14168) 2017-05-03 14:29:48 -07:00
resource_google_project_services.go provider/google: Add pagination for reading project services (#13758) 2017-05-01 16:33:51 -07:00
resource_google_project_test.go Prune dead function. 2017-03-14 16:38:40 -07:00
resource_google_project.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_google_service_account_test.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
resource_google_service_account.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_pubsub_subscription_test.go proovider/google: Adding test for google_pubsub_subscription path 2017-05-05 16:57:24 +03:00
resource_pubsub_subscription.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_pubsub_topic_test.go provider/google: Fix Pubsub acceptance tests 2016-03-02 15:36:32 -08:00
resource_pubsub_topic.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_sql_database_instance_test.go provider/google-cloud: Add maintenance window (#12042) 2017-02-18 01:33:47 +02:00
resource_sql_database_instance.go Fix issue with GCP Cloud SQL Instance disk_autoresize (#14582) 2017-05-18 15:09:01 -05:00
resource_sql_database_test.go provider/google: limit hardcoded test resource names 2016-01-05 19:49:06 -05:00
resource_sql_database.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_sql_user_test.go provider/google: SQL user resource, documentation & tests 2016-01-13 16:33:08 -05:00
resource_sql_user.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_storage_bucket_acl_test.go provider/google: Address flaky GCS acceptance tests. 2016-03-07 14:26:19 -08:00
resource_storage_bucket_acl.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_storage_bucket_object_test.go Add additional properties for google resource storage bucket object. (#14259) 2017-05-08 16:35:47 -07:00
resource_storage_bucket_object.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resource_storage_bucket_test.go Make google resource storage bucket importable (#14455) 2017-05-15 19:38:32 +03:00
resource_storage_bucket.go Make google resource storage bucket importable (#14455) 2017-05-15 19:38:32 +03:00
resource_storage_object_acl_test.go provider/google: Address flaky GCS acceptance tests. 2016-03-07 14:26:19 -08:00
resource_storage_object_acl.go provider/google: Handle all 404 checks in read functions via the new function 2017-05-10 14:50:19 +03:00
resourcemanager_operation.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
service_scope.go provider/google: add scope aliases 2016-10-19 23:14:55 +03:00
serviceman_operation.go providers/google: Support managing projects 2017-01-25 14:59:50 -08:00
sqladmin_operation.go provider/google: log the op name in sql op errors. 2017-03-03 16:45:25 -08:00