I just started to study GCP deployment-manager and I'm creating a file to create one network and one subnetwork. I did a test using 2 different files (one for each) and worked fine. Now, when I combine the creation of network and subnetwork, there's 2 problems:
During creation, when network finish the creation and the step of subnetwork starts, looks like that network info is not yet created and I got an error of resource not found. But If I run an update again, the subnet is created.
During the delete, deployment-manager tries to delete first the network before the subnetwork and I got the message "resource is in use, you can't delete".
So,m I would like to get a help here with best practices about this. Many thanks.
My config:
main.yml
imports:
- path: network.jinja
- path: subnetwork.jinja
resources:
- name: network
type: network.jinja
- name: subnetwork
type: subnetwork.jinja
network.jinja
resources:
- type: gcp-types/compute-v1:networks
name: network-{{ env["deployment"] }}
properties:
routingConfig:
routingMode: REGIONAL
autoCreateSubnetworks: false
subnetwork.jinja
resources:
- type: gcp-types/compute-v1:subnetworks
name: subnetwork-{{ env["deployment"] }}
properties:
region: us-central1
network: https://www.googleapis.com/compute/v1/projects/XXXXXXXX/global/networks/network-{{ env["deployment"] }}
ipCidrRange: 10.10.10.0/24
privateIpGoogleAccess: false