OpenNebula provider for Terraform.
- Leverages OpenNebula's XML/RPC API
- Tested for versions 5.X
The provider tries to impose a lightweight level of abstraction on OpenNebula's resources. This means that only the most fundamental attributes are directly accessible (i.e. names, IDs, permissions and user/group identities). For maximum flexibility and portability, the remaining attributes can be specified using any of the formats natively accepted by OpenNebula (XML and String).
Create a file called demo_template.txt
.
Notice how we need to escape native variables $$USER[SSH_PUBLIC_KEY]
with two dollar signs, as terraform will try to replace all variables with a single dollar sign)
CUSTOM_ATTRIBUTE = "${CUSTOM_ATTRIBUTE_VALUE}"
CONTEXT = [
DNS_HOSTNAME = "yes",
NETWORK = "YES",
SSH_PUBLIC_KEY = "$$USER[SSH_PUBLIC_KEY]",
USERNAME = "root" ]
CPU = "0.5"
VCPU = "4"
MEMORY = "3000"
GRAPHICS = [
KEYMAP = "en",
LISTEN = "0.0.0.0",
TYPE = "VNC" ]
And the following terraform.tf
file:
provider "opennebula" {
endpoint = "api's endpoint"
username = "user's name"
password = "user's password"
}
data "template_file" "demo" {
template = "${file("demo_template.txt")}"
vars = {
CUSTOM_ATTRIBUTE_VALUE = "demo-me"
}
}
resource "opennebula_template" "demo" {
name = "terraform-demo"
description = "${data.template_file.demo.rendered}"
permissions = "600"
}
output "demo_template_id" {
value = "${opennebula_template.demo.id}"
}
output "demo_template_uname" {
value = "${opennebula_template.demo.uname}"
}
The following list represent's all of OpenNebula's resources reachable through their API. The checked items are the ones that are fully functional and tested:
- onevm
- onetemplate
- onehost
- onecluster
- onegroup
- onevdc
- onevnet
- oneuser
- onedatastore
- oneimage
- onemarket
- onemarketapp
- onevrouter
- onezone
- onesecgroup
- oneacl
- oneacct
Bug reports and pull requests are welcome on GitHub at https://github.com/runtastic/terraform-provider-opennebula. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Check out our career page if you'd like to work with us.
The gem is available as open source under the terms of the MIT License.