|
|
|
@ -21,15 +21,6 @@
|
|
|
|
|
# the TF file, however, this may not be secure if you plan to share this TF
|
|
|
|
|
# file with others.
|
|
|
|
|
|
|
|
|
|
terraform {
|
|
|
|
|
required_providers {
|
|
|
|
|
decort = {
|
|
|
|
|
version = "4.0.0"
|
|
|
|
|
source = "basis/decort/decort"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
provider "decort" {
|
|
|
|
|
authenticator = "oauth2"
|
|
|
|
|
controller_url = "<<DECORT_CONTROLLER_URL>>" # specify correct DECORT controller URL, e.g. "https://ds1.digitalenergy.online"
|
|
|
|
@ -50,7 +41,7 @@ data "decort_image" "os_image" {
|
|
|
|
|
# 4. Create new Resource Group in the selected account, new VM will be created in this RG
|
|
|
|
|
resource "decort_resgroup" "my_rg" {
|
|
|
|
|
name = "NewRgByTF"
|
|
|
|
|
account_id = data.decort_account.my_account.id
|
|
|
|
|
account_id = data.decort_account.my_account.account_id
|
|
|
|
|
gid = <GRID_ID> # Grid (platform) ID
|
|
|
|
|
# if you want to set resource quota on this Resource Group, uncomment
|
|
|
|
|
# the following code fragment
|
|
|
|
@ -66,7 +57,7 @@ resource "decort_resgroup" "my_rg" {
|
|
|
|
|
# and comment out extra_disks parameter when creating VM below.
|
|
|
|
|
resource "decort_disk" "extra_disk" {
|
|
|
|
|
disk_name = "extra-disk-for-vm"
|
|
|
|
|
account_id = data.decort_account.my_account.id
|
|
|
|
|
account_id = data.decort_account.my_account.account_id
|
|
|
|
|
gid = <GRID_ID> # Grid (platform) ID
|
|
|
|
|
size_max = 5 # disk size in GB
|
|
|
|
|
type = "D" # disk type, always use "D" for extra disks
|
|
|
|
@ -81,12 +72,12 @@ resource "decort_disk" "extra_disk" {
|
|
|
|
|
# specified size and one extra disk attached.
|
|
|
|
|
resource "decort_kvmvm" "my_new_vm" {
|
|
|
|
|
name = "tf-managed-vm"
|
|
|
|
|
driver = "KVM_X86" # Compute virtualization driver
|
|
|
|
|
rg_id = decort_resgroup.my_rg.id
|
|
|
|
|
arch = "KVM_X86" # "KVM_PPC" for IBM Power or "KVM_X86" for Intel
|
|
|
|
|
cpu = 1 # CPU count
|
|
|
|
|
ram = 1024 # RAM size in MB, must be even number, ideally a power of 2
|
|
|
|
|
boot_disk_size = 10 # Boot disk size in GB
|
|
|
|
|
image_id = data.decort_image.os_image.id
|
|
|
|
|
image_id = data.decort_image.os_image.image_id
|
|
|
|
|
description = "Test KVM VM Compute managed by Terraform"
|
|
|
|
|
extra_disks = [ decort_disk.extra_disk.id ]
|
|
|
|
|
|
|
|
|
|