File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ check "hashistack-allocated-cpu" {
6767
6868- ` snapshot_id ` ` (string: <required>) ` - The Droplet image ID.
6969
70- - ` user_data ` ` (string: "") ` - A string of the desired User Data for the Droplet or a path to a file containing the User Data
70+ - ` user_data ` ` (string: "") ` - A (raw or base64-encoded) string of the desired User Data for the Droplet,
71+ or a path to a file containing the User Data
7172
7273- ` ssh_keys ` ` (string: "") ` - A comma-separated list of SSH fingerprints to enable
7374
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package plugin
22
33import (
44 "context"
5+ "encoding/base64"
56 "errors"
67 "fmt"
78 "io"
@@ -117,8 +118,14 @@ func (t *TargetPlugin) scaleOut(
117118 // file was found at this location, so use its content
118119 createRequest .UserData = string (content )
119120 } else {
120- // assume the string contains the user data
121- createRequest .UserData = template .userData
121+ // assume the string contains the user data, which
122+ // maybe be base64-encoded
123+ decodedData , err := base64 .StdEncoding .DecodeString (template .userData )
124+ if err == nil {
125+ createRequest .UserData = string (decodedData )
126+ } else {
127+ createRequest .UserData = template .userData
128+ }
122129 }
123130 }
124131
You can’t perform that action at this time.
0 commit comments