Skip to content

Commit

Permalink
vultr: add notify_activate option
Browse files Browse the repository at this point in the history
This commit adds an option to enable or disable emails when servers and
baremetal servers are activated. It defaults to false. Addresses #51.
  • Loading branch information
squat committed Oct 29, 2018
1 parent 92291aa commit 59cbee0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
19 changes: 13 additions & 6 deletions vultr/resource_bare_metal.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ func resourceBareMetal() *schema.Resource {
Optional: true,
},

"notify_activate": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"os_id": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -141,12 +147,13 @@ func resourceBareMetalCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*Client)
options := &lib.BareMetalServerOptions{
AppID: d.Get("application_id").(string),
Hostname: d.Get("hostname").(string),
IPV6: d.Get("ipv6").(bool),
Script: d.Get("startup_script_id").(int),
Snapshot: d.Get("snapshot_id").(string),
Tag: d.Get("tag").(string),
AppID: d.Get("application_id").(string),
DontNotifyOnActivate: !d.Get("notify_activate").(bool),
Hostname: d.Get("hostname").(string),
IPV6: d.Get("ipv6").(bool),
Script: d.Get("startup_script_id").(int),
Snapshot: d.Get("snapshot_id").(string),
Tag: d.Get("tag").(string),
}

name := d.Get("name").(string)
Expand Down
27 changes: 17 additions & 10 deletions vultr/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func resourceInstance() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},

"notify_activate": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},

"os_id": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -203,16 +209,17 @@ func resourceInstanceCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*Client)
options := &lib.ServerOptions{
AppID: d.Get("application_id").(string),
AutoBackups: d.Get("auto_backups").(bool),
FirewallGroupID: d.Get("firewall_group_id").(string),
Hostname: d.Get("hostname").(string),
IPV6: d.Get("ipv6").(bool),
PrivateNetworking: d.Get("private_networking").(bool),
Script: d.Get("startup_script_id").(int),
Snapshot: d.Get("snapshot_id").(string),
Tag: d.Get("tag").(string),
UserData: d.Get("user_data").(string),
AppID: d.Get("application_id").(string),
AutoBackups: d.Get("auto_backups").(bool),
DontNotifyOnActivate: !d.Get("notify_activate").(bool),
FirewallGroupID: d.Get("firewall_group_id").(string),
Hostname: d.Get("hostname").(string),
IPV6: d.Get("ipv6").(bool),
PrivateNetworking: d.Get("private_networking").(bool),
Script: d.Get("startup_script_id").(int),
Snapshot: d.Get("snapshot_id").(string),
Tag: d.Get("tag").(string),
UserData: d.Get("user_data").(string),
}

name := d.Get("name").(string)
Expand Down

0 comments on commit 59cbee0

Please sign in to comment.