From a1986fda5f25050473f64d71c19ed085125c1623 Mon Sep 17 00:00:00 2001 From: Haardik Dharma Date: Wed, 10 Jul 2024 13:11:19 -0700 Subject: [PATCH 1/2] Change instance config to use the correct parameter --- cmd/instance/instance_create.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/instance/instance_create.go b/cmd/instance/instance_create.go index 632961d0..ddcaabf0 100644 --- a/cmd/instance/instance_create.go +++ b/cmd/instance/instance_create.go @@ -139,8 +139,9 @@ If you wish to use a custom format, the available fields are: } } + // Set public ipv4 if provided if publicip != "" { - config.PublicIPRequired = publicip + config.ReservedIPv4 = publicip } // Set private_ipv4 if provided From b63e32b19fd4ade6bf91d2fde1754db5a67047b4 Mon Sep 17 00:00:00 2001 From: Haardik Dharma Date: Thu, 11 Jul 2024 13:11:21 -0700 Subject: [PATCH 2/2] Add a new flag for reservedIP --- cmd/instance/instance.go | 1 + cmd/instance/instance_create.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/instance/instance.go b/cmd/instance/instance.go index 7c26d31a..68902c5e 100644 --- a/cmd/instance/instance.go +++ b/cmd/instance/instance.go @@ -54,6 +54,7 @@ func init() { instanceCreateCmd.Flags().StringVarP(&firewall, "firewall", "l", "", "the instance's firewall you can use the Name or the ID") instanceCreateCmd.Flags().StringVarP(&tags, "tags", "g", "", "the instance's tags") instanceCreateCmd.Flags().StringVarP(&privateIPv4, "private_ipv4", "", "", "Private IPv4 address") + instanceCreateCmd.Flags().StringVarP(&reservedIPv4, "reservedip", "", "", "Reserved IPv4 address") instanceCreateCmd.Flags().StringVarP(&tags, "region", "e", "", "the region code identifier to have your instance built in") instanceCreateCmd.Flags().StringVar(&script, "script", "", "path to a script that will be uploaded to /usr/local/bin/civo-user-init-script on your instance, read/write/executable only by root and then will be executed at the end of the cloud initialization") instanceCreateCmd.Flags().BoolVar(&skipShebangCheck, "skip-shebang-check", false, "skip the shebang line check when passing a user init script") diff --git a/cmd/instance/instance_create.go b/cmd/instance/instance_create.go index ddcaabf0..fce5cb48 100644 --- a/cmd/instance/instance_create.go +++ b/cmd/instance/instance_create.go @@ -18,7 +18,7 @@ import ( ) var wait bool -var hostnameCreate, size, diskimage, publicip, initialuser, sshkey, tags, network, privateIPv4, firewall string +var hostnameCreate, size, diskimage, publicip, initialuser, sshkey, tags, network, privateIPv4, reservedIPv4, firewall string var script string var skipShebangCheck bool @@ -141,7 +141,12 @@ If you wish to use a custom format, the available fields are: // Set public ipv4 if provided if publicip != "" { - config.ReservedIPv4 = publicip + config.PublicIPRequired = publicip + } + + // Set reserved ip if provided + if reservedIPv4 != "" { + config.ReservedIPv4 = reservedIPv4 } // Set private_ipv4 if provided