Library to compose and run GCP gcloud cli commands.
gcp_network_create(
project => 'my-project',
name => 'my-network');
Create a new GCP VPC network
my $ret = gcp_network_delete(name => 'my-network');
Delete a VPC network. Does not assert but returns the exit code.
gcp_subnet_create(
project => 'my-project',
region => 'us-central1',
name => 'my-subnet',
network => 'my-network',
cidr => '10.0.0.0/24');
Create a subnet within a VPC network
my $ret = gcp_subnet_delete(
region => 'us-central1',
name => 'my-subnet');
Delete a subnet. Does not assert but returns the exit code.
gcp_firewall_rule_create(
project => 'my-project',
name => 'allow-ssh',
network => 'my-network',
port => 22);
Create a firewall rule to allow inbound traffic on a specific port
my $ret = gcp_firewall_rule_delete(name => 'allow-ssh');
Delete a firewall rule. Does not assert but returns the exit code.
gcp_external_ip_create(
project => 'my-project',
region => 'us-central1',
name => 'my-ip');
Reserve an external static IP address
my $ret = gcp_external_ip_delete(
region => 'us-central1',
name => 'my-ip');
Release an external IP address. Does not assert but returns the exit code.
gcp_vm_create(
project => 'my-project',
zone => 'us-central1-a',
name => 'my-vm',
image => 'sles-sap-$version',
image_prject => 'cloud',
machine_type => 'n1-standard-2',
network => 'my-network',
subnet => 'my-subnet',
address => 'my-ip',
ssh_key => 'ssh public key file);
Create a VM instance
gcp_vm_wait_running(
zone => 'us-central1-a',
name => 'my-vm',
timeout => 300);
Wait for a VM instance to reach RUNNING state
my $ret = gcp_vm_terminate(
zone => 'us-central1-a',
name => 'my-vm');
Delete a VM instance. Does not assert but returns the exit code.
my $ip = gcp_public_ip_get(
project => 'my-project',
zone => 'us-central1-a',
name => 'my-vm');
Get the external (public) IP address of a VM instance
gcp_ncc_spoke_create(
project => 'my-project',
name => 'my-spoke',
hub => 'projects/ibsm-project/locations/global/hubs/ibsm-hub',
network => 'my-network');
Create a VPC spoke and attach it to an NCC hub. The hub may be in a different project.
my $ret = gcp_ncc_spoke_delete(name => 'my-spoke' [, timeout => 600]);
Delete a VPC spoke. Does not assert but returns the exit code.
gcp_ncc_spoke_wait_active(name => 'my-spoke' [, timeout => 300]);
Wait for an NCC spoke to reach ACTIVE state. Die if it does not reach ACTIVE state within timeout.