I am facing an issue where using quotas in opennebula_user applies only in one of our two zones, and detects drift when creating resources without defining a quota.
Instead of using an attribute, I suggest to add a new resource opennebula_user_quota to be able to select the zone where the quotas will apply.
In the HCL bellow, all opennebula_user_quota > scope conflict with each others.
units, running_units, size, running_size, leases are optional. If not set, the value is -1, meaning ∞.
Since a quota doesn't have any ID in the OpenNebula side, there is no way to import. Even if the quota exists, terraforming a new one will override it.
In the same way, there is no data source, but quotas might be returned when fetching opennebula_user as usual.
New or affected resources and data sources
opennebula_user
opennebula_user_quotas
Potential terraform configuration
resource "opennebula_user" "hw" {
name = "My User"
# quotas {} # Deprecated
}
resource "opennebula_user_quota" "vm" {
user_id = opennebula_user.hw.id
scope = "vm"
units = 8 # Number of units
running_units = 8 # Number of running units
}
resource "opennebula_user_quota" "cpu" {
user_id = opennebula_user.hw.id
scope = "cpu"
units = 16 # Number of units
running_units = 16 # Number of running units
}
resource "opennebula_user_quota" "memory" {
user_id = opennebula_user.hw.id
scope = "memory"
size = 16384 # Size in MB
running_size = 16384 # Size of running memory in MB
}
resource "opennebula_user_quota" "system_disks" {
user_id = opennebula_user.hw.id
scope = "system_disks"
size = 20480 # Size in MB
}
resource "opennebula_user_quota" "image" {
user_id = opennebula_user.hw.id
scope = "image"
image_id = 100 # Only if scope=image
units = 2 # Number of units
}
resource "opennebula_user_quota" "network" {
user_id = opennebula_user.hw.id
scope = "network"
units = 1 # Number of units
}
resource "opennebula_user_quota" "datastore" {
user_id = opennebula_user.hw.id
scope = "datastore"
datastore_id = 100 # Only if scope=datastore
units = 1 # Number of units
size = 10240 # Size in MB. Only available if scope=datastore
}
Description
I am facing an issue where using
quotas
inopennebula_user
applies only in one of our two zones, and detects drift when creating resources without defining a quota.Instead of using an attribute, I suggest to add a new resource
opennebula_user_quota
to be able to select the zone where the quotas will apply.In the HCL bellow, all
opennebula_user_quota
>scope
conflict with each others.units
,running_units
,size
,running_size
,leases
are optional. If not set, the value is-1
, meaning∞
.Since a quota doesn't have any ID in the OpenNebula side, there is no way to import. Even if the quota exists, terraforming a new one will override it.
In the same way, there is no data source, but quotas might be returned when fetching
opennebula_user
as usual.New or affected resources and data sources
opennebula_user
opennebula_user_quotas
Potential terraform configuration
References
447