Skip to content

Commit

Permalink
Allow for specifying reserved IP address
Browse files Browse the repository at this point in the history
Closes #25
  • Loading branch information
janeczku committed Aug 10, 2017
1 parent d9aedbd commit f457aca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ Command line flags:
- `--vultr-private-networking`: Enable private networking support for the VPS.
- `--vultr-backups`: Enable automatic backups for the VPS.
- `--vultr-userdata`: Path to file with cloud-init user-data.
- `--vultr-snapshot-id`: Using snapshot to create host.
- `--vultr-snapshot-id`: ID of an existing Snapshot in your Vultr account.
- `--vultr-reserved-ip`: ID of a reserved IP in your Vultr account.
- `--vultr-tag`: Tag to assign to the VPS.
- `--vultr-firewall-group`: ID of existing firewall group to assign.
- `--vultr-api-endpoint`: Override default Vultr API endpoint URL.
Expand Down Expand Up @@ -100,6 +101,7 @@ The operating system must support cloud-init and be configured to use the `ec2`
| `--vultr-backups` | `VULTR_BACKUPS` | `false` |
| `--vultr-userdata` | `VULTR_USERDATA` | - |
| `--vultr-snapshot-id` | `VULTR_SNAPSHOT` | - |
| `--vultr-reserved-ip` | `VULTR_RESERVED_IP` | - |
| `--vultr-tag` | `VULTR_TAG` | - |
| `--vultr-firewall-group` | `VULTR_FIREWALL_GROUP` | - |
| `--vultr-api-endpoint` | `VULTR_API_ENDPOINT` | - |
Expand Down
8 changes: 8 additions & 0 deletions vultr.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Driver struct {
SSHKeyID string
VultrPublicKey string
ROSVersion string
ReservedIP string
IPv6 bool
Backups bool
PrivateNetworking bool
Expand Down Expand Up @@ -113,6 +114,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: "vultr-ssh-key-id",
Usage: "ID of an existing SSH key in your Vultr account.",
},
mcnflag.StringFlag{
EnvVar: "VULTR_RESERVED_IP",
Name: "vultr-reserved-ip",
Usage: "ID of a reserved IP in your Vultr account.",
},
mcnflag.BoolFlag{
EnvVar: "VULTR_IPV6",
Name: "vultr-ipv6",
Expand Down Expand Up @@ -183,6 +189,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.PxeScriptID = flags.Int("vultr-pxe-script")
d.BootScriptID = flags.Int("vultr-boot-script")
d.SSHKeyID = flags.String("vultr-ssh-key-id")
d.ReservedIP = flags.String("vultr-reserved-ip")
d.IPv6 = flags.Bool("vultr-ipv6")
d.PrivateNetworking = flags.Bool("vultr-private-networking")
d.Backups = flags.Bool("vultr-backups")
Expand Down Expand Up @@ -327,6 +334,7 @@ func (d *Driver) Create() error {
DontNotifyOnActivate: true,
Tag: d.VultrTag,
FirewallGroupID: d.FirewallGroupID,
ReservedIP: d.ReservedIP,
})
if err != nil {
return err
Expand Down

0 comments on commit f457aca

Please # to comment.