Skip to content

Commit

Permalink
Change instance config to use the correct Reserved IP parameter (#439)
Browse files Browse the repository at this point in the history
* Change instance config to use the correct parameter

* Add a new flag for reservedIP
  • Loading branch information
haardikdharma10 authored Jul 16, 2024
1 parent f2c1da3 commit 4b1307b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 7 additions & 1 deletion cmd/instance/instance_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -139,10 +139,16 @@ If you wish to use a custom format, the available fields are:
}
}

// Set public ipv4 if provided
if publicip != "" {
config.PublicIPRequired = publicip
}

// Set reserved ip if provided
if reservedIPv4 != "" {
config.ReservedIPv4 = reservedIPv4
}

// Set private_ipv4 if provided
if privateIPv4 != "" {
config.PrivateIPv4 = privateIPv4
Expand Down

0 comments on commit 4b1307b

Please sign in to comment.