provider-gcp icon indicating copy to clipboard operation
provider-gcp copied to clipboard

Cannot delete Network switched from Auto to Custom mode

Open hasheddan opened this issue 5 years ago • 0 comments

What happened?

If you choose to modify the Network and make it autoCreateSubnetworks: false when it was previously autoCreateSubnetworks: true (i.e. go from Auto to Custom), you cannot delete the Network because there were many subnetworks provisioned at creation, and it is no longer an Auto network. In order to delete, we would need to go through and delete each subnetwork.

Ref: https://github.com/crossplaneio/stack-gcp/pull/151#issuecomment-586356682

How can we reproduce it?

Create a Network with autoCreateSubnetworks: true:

apiVersion: compute.gcp.crossplane.io/v1beta1
kind: Network
metadata:
  name: sample-network-auto
spec:
  forProvider:
    autoCreateSubnetworks: true
  reclaimPolicy: Delete
  providerRef:
    name: gcp-provider

Update the Network with autoCreateSubnetworks: false:

apiVersion: compute.gcp.crossplane.io/v1beta1
kind: Network
metadata:
  name: sample-network-auto
spec:
  forProvider:
    autoCreateSubnetworks: false
  reclaimPolicy: Delete
  providerRef:
    name: gcp-provider

Attempt to delete sample-network-auto.

Proposed Fix

If we wanted to "fix" this in the future, we would need to get all of the subnetworks that were auto-created from the Status of the Network, delete them one by one in the Network controller, then delete the Network. We could also manually create the Subnetworks as crossplane objects, or "import" them whenever that functionality is available.

Ref: https://github.com/crossplaneio/stack-gcp/pull/151#issuecomment-586911039

What environment did it happen in?

Crossplane version: v0.7.0 stack-gcp version: v0.6.0 (introduced in https://github.com/crossplaneio/stack-gcp/pull/151 for inclusion in v0.6.0)

hasheddan avatar Feb 17 '20 14:02 hasheddan