Skip to content

Commit

Permalink
Add a new flag for reservedIP
Browse files Browse the repository at this point in the history
  • Loading branch information
haardikdharma10 committed Jul 11, 2024
1 parent a1986fd commit b63e32b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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
9 changes: 7 additions & 2 deletions 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 @@ -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
Expand Down

0 comments on commit b63e32b

Please sign in to comment.