For the UserData option to work, when creating a server in the RackSpace cloud, the ConfigDrive option has to be set to 'true'.
This does not work:
userData := `#cloud-config
runcmd:
- touch /root/testing`
server, err := servers.Create(client, servers.CreateOpts{
Name: "test",
ImageRef: image,
FlavorRef: flavor,
UserData: []byte(userData),
}).Extract()
This works:
userData := `#cloud-config
runcmd:
- touch /root/testing`
server, err := servers.Create(client, servers.CreateOpts{
Name: "test",
ImageRef: image,
FlavorRef: flavor,
UserData: []byte(userData),
ConfigDrive: true,
}).Extract()
Possibly it should be checking if UserData is set and then setting ConfigDrive to true if it is.