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