Skip to content

Commit

Permalink
update deli-cli and add instance user data
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Jan 27, 2018
1 parent 2ebdb9a commit 1b4e4c0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import:
- package: github.com/hashicorp/terraform
version: 0.10.0
- package: github.com/sandwichcloud/deli-cli
version: 0.0.20
version: 0.0.23
10 changes: 9 additions & 1 deletion sandwich/resource_sandwich_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ func resourceInstance() *schema.Resource {
Type: schema.TypeString,
},
},
"user_data": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
}
Expand All @@ -96,6 +102,7 @@ func resourceInstanceCreate(d *schema.ResourceData, meta interface{}) error {
zoneID := d.Get("zone_id").(string)
flavorID := d.Get("flavor_id").(string)
disk := d.Get("disk").(int)
userData := d.Get("user_data").(string)
var keypairIDs []string
tags := map[string]string{}

Expand All @@ -107,7 +114,7 @@ func resourceInstanceCreate(d *schema.ResourceData, meta interface{}) error {
tags[k] = v.(string)
}

instance, err := instanceClient.Create(name, imageID, regionID, zoneID, networkID, serviceAccountID, flavorID, disk, keypairIDs, tags)
instance, err := instanceClient.Create(name, imageID, regionID, zoneID, networkID, serviceAccountID, flavorID, disk, keypairIDs, tags, userData)
if err != nil {
return err
}
Expand Down Expand Up @@ -162,6 +169,7 @@ func resourceInstanceRead(d *schema.ResourceData, meta interface{}) error {
d.Set("zone_id", instance.ZoneID.String())
d.Set("flavor_id", instance.FlavorID.String())
d.Set("disk", instance.Disk)
d.Set("user_data", instance.UserData)
var keypairIDs []string
tags := map[string]string{}

Expand Down

0 comments on commit 1b4e4c0

Please sign in to comment.