Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/1.9.3 #633

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 1.9.3 (September 7, 2023)
[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.9.2...feat/1.9.3)

**Merged pull request:**
- Setting machine type in updating virtual machines. [\#630](https://github.com/nutanix/terraform-provider-nutanix/pull/630)
- Added examples of role creation using nutanix terraform provider. [\#632](https://github.com/nutanix/terraform-provider-nutanix/pull/632)

**Fixed bugs:**
- Updating gives error: Machine type must be set to Q35 for secure boot. [\#622](https://github.com/nutanix/terraform-provider-nutanix/issues/622)
- Machine type must be set to Q35 for secure boot. [\#494](https://github.com/nutanix/terraform-provider-nutanix/issues/494)

**Closed issues:**
- Add support documentation in terraform. [\#611](https://github.com/nutanix/terraform-provider-nutanix/issues/611)

**Closed pull request:**
- Fix Secure boot VMs when doing updates. [\#496](https://github.com/nutanix/terraform-provider-nutanix/pull/496)


## 1.9.2 (July 21, 2023)
[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.9.1...feat/1.9.2)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Terraform provider plugin to integrate with Nutanix Enterprise Cloud

NOTE: The latest version of the Nutanix provider is [v1.9.2](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.2)
NOTE: The latest version of the Nutanix provider is [v1.9.3](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.3)

Modules based on Terraform Nutanix Provider can be found here : [Modules](https://github.com/nutanix/terraform-provider-nutanix/tree/master/modules)
## Build, Quality Status
Expand Down
77 changes: 77 additions & 0 deletions examples/role/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
provider "nutanix" {
username = var.user
password = var.password
endpoint = var.endpoint
insecure = var.insecure
port = var.port
wait_timeout = 60
}

# Create Kubernetes Infrastructure Provision role
# ---------------
data "nutanix_permission" "k8s_infra_provision_permissions" {
for_each = toset(var.k8s_infra_provision_permissions)
permission_name = each.key
}

resource "nutanix_role" "kubernetes_infrastructure_provision" {
name = "Kubernetes Infrastructure Provision"
description = "Access for Kubernetes cluster infrastructure VMs resources"
dynamic "permission_reference_list" {
for_each = data.nutanix_permission.k8s_infra_provision_permissions
content {
kind = "permission"
uuid = permission_reference_list.value.id
}
}
}

data "nutanix_role" "kubernetes_infrastructure_provision" {
role_id = nutanix_role.kubernetes_infrastructure_provision.id
}

# Create CSI System role
# ---------------
data "nutanix_permission" "csi_system_role_permissions" {
for_each = toset(var.csi_system_role_permissions)
permission_name = each.key
}

resource "nutanix_role" "csi_system" {
name = "CSI System"
description = "Full access for Kubernetes cluster infrastructure resources for CSI"
dynamic "permission_reference_list" {
for_each = data.nutanix_permission.csi_system_role_permissions
content {
kind = "permission"
uuid = permission_reference_list.value.id
}
}
}

data "nutanix_role" "csi_system" {
role_id = nutanix_role.csi_system.id
}

# Create Kubernetes Data Services System role
# ---------------
data "nutanix_permission" "k8s_data_services_system_role_permissions" {
for_each = toset(var.k8s_data_services_system_role_permissions)
permission_name = each.key
}

resource "nutanix_role" "k8s_data_services_system" {
name = "Kubernetes Data Services System"
description = "Full access for Kubernetes cluster infrastructure resources for Kubernetes Data Services"
dynamic "permission_reference_list" {
for_each = data.nutanix_permission.k8s_data_services_system_role_permissions
content {
kind = "permission"
uuid = permission_reference_list.value.id
}
}
}

data "nutanix_role" "k8s_data_services_system" {
role_id = nutanix_role.k8s_data_services_system.id
}
11 changes: 11 additions & 0 deletions examples/role/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "k8s_infra_provision_role_id" {
value = data.nutanix_role.kubernetes_infrastructure_provision.id
}

output "k8s_data_services_system_role_id" {
value = data.nutanix_role.k8s_data_services_system.id
}

output "csi_system_role_id" {
value = data.nutanix_role.csi_system.id
}
184 changes: 184 additions & 0 deletions examples/role/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
variable "user" {
type = string
}
variable "password" {
type = string
}
variable "endpoint" {
type = string
}
variable "insecure" {
type = bool
}
variable "port" {
type = number
}

variable "k8s_infra_provision_permissions" {
type = list(string)
default = [
"Create_Category_Mapping",
"Create_Image",
"Create_Or_Update_Name_Category",
"Create_Or_Update_Value_Category",
"Create_Virtual_Machine",
"Delete_Category_Mapping",
"Delete_Image",
"Delete_Name_Category",
"Delete_Value_Category",
"Delete_Virtual_Machine",
"Update_Category_Mapping",
"Update_Virtual_Machine_Project",
"Update_Virtual_Machine",
"View_Category_Mapping",
"View_Cluster",
"View_Image",
"View_Name_Category",
"View_Project",
"View_Subnet",
"View_Value_Category",
"View_Virtual_Machine"
]
}

variable "csi_system_role_permissions" {
type = list(string)
default = [
"Create_Volume_Group_Disk",
"Delete_Volume_Group_Disk",
"Update_Volume_Group_Disk_Internal",
"View_Project",
"View_Task",
"Create_Or_Update_Value_Category",
"Create_Category",
"View_Name_Category",
"View_Category",
"View_External_iSCSI_Client",
"View_VM_Recovery_Point",
"View_Virtual_Machine",
"View_Volume_Group_Details",
"View_Volume_Group_Disks",
"View_Volume_Group_iSCSI_Attachments",
"View_Volume_Group_VM_Attachments",
"View_Volume_Group_Category_Associations",
"View_Volume_Group_Metadata",
"Create_Virtual_Machine",
"Restore_VM_Recovery_Point",
"Delete_Image",
"Associate_Volume_Group_Categories",
"Disassociate_Volume_Group_Categories",
"Update_Virtual_Machine_Project",
"Update_Container_Disks",
"View_Image",
"Create_Category_Mapping",
"Create_Volume_Group",
"Delete_Category_Mapping",
"Update_Category_Mapping",
"View_Category_Mapping",
"View_Subnet",
"Delete_Availability_Zone",
"Create_Or_Update_Name_Category",
"Delete_Volume_Group",
"View_Cluster",
"View_Value_Category",
"Delete_Category",
"Create_Image",
"Delete_Virtual_Machine",
"View_Container",
"View_Storage_Container",
"View_Any_Virtual_Machine",
"Create_Job",
"Update_Virtual_Machine",
"Update_Network_Function_Chain",
"Delete_Name_Category",
"Create_Vm_Snapshot",
"Update_Account",
"Delete_Value_Category",
"Update_Category",
"Update_Remote_Connection",
"Attach_Volume_Group_To_External_iSCSI_Client",
"Detach_Volume_Group_From_External_iSCSI_Client",
"Create_Consistency_Group",
"Update_Consistency_Group",
"View_Consistency_Group",
"Create_Recovery_Point",
"View_Recovery_Point",
"Delete_Recovery_Point",
"Set_Expiration_Time_Recovery_Point",
"View_Container_Datastore",
"View_Container_Stats",
"Update_Volume_Group_Details_Internal",
"Update_External_iSCSI_Client_Internal"
]
}

variable "k8s_data_services_system_role_permissions" {
type = list(string)
default = [
"Create_Volume_Group_Disk",
"Delete_Volume_Group_Disk",
"Update_Volume_Group_Disk_Internal",
"View_Project",
"View_Task",
"Create_Or_Update_Value_Category",
"Create_Category",
"View_Name_Category",
"View_Category",
"View_External_iSCSI_Client",
"View_VM_Recovery_Point",
"View_Virtual_Machine",
"View_Volume_Group_Details",
"View_Volume_Group_Disks",
"View_Volume_Group_iSCSI_Attachments",
"View_Volume_Group_VM_Attachments",
"View_Volume_Group_Category_Associations",
"View_Volume_Group_Metadata",
"Create_Virtual_Machine",
"Restore_VM_Recovery_Point",
"Delete_Image",
"Associate_Volume_Group_Categories",
"Disassociate_Volume_Group_Categories",
"Update_Virtual_Machine_Project",
"Update_Container_Disks",
"View_Image",
"Create_Category_Mapping",
"Create_Volume_Group",
"Delete_Category_Mapping",
"Update_Category_Mapping",
"View_Category_Mapping",
"View_Subnet",
"Delete_Availability_Zone",
"Create_Or_Update_Name_Category",
"Delete_Volume_Group",
"View_Cluster",
"View_Value_Category",
"Delete_Category",
"Create_Image",
"Delete_Virtual_Machine",
"View_Container",
"View_Storage_Container",
"View_Any_Virtual_Machine",
"Create_Job",
"Update_Virtual_Machine",
"Update_Network_Function_Chain",
"Delete_Name_Category",
"Create_Vm_Snapshot",
"Update_Account",
"Delete_Value_Category",
"Update_Category",
"Update_Remote_Connection",
"Attach_Volume_Group_To_External_iSCSI_Client",
"Detach_Volume_Group_From_External_iSCSI_Client",
"Create_Consistency_Group",
"Update_Consistency_Group",
"View_Consistency_Group",
"Create_Recovery_Point",
"View_Recovery_Point",
"Delete_Recovery_Point",
"Set_Expiration_Time_Recovery_Point",
"View_Container_Datastore",
"View_Container_Stats",
"Update_Volume_Group_Details_Internal",
"Update_External_iSCSI_Client_Internal"
]
}
8 changes: 8 additions & 0 deletions examples/role/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
nutanix = {
source = "nutanix/nutanix"
version = "1.9.2"
}
}
}
1 change: 1 addition & 0 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,7 @@ func preFillResUpdateRequest(res *v3.VMResources, response *v3.VMIntentResponse)
res.VgaConsoleEnabled = response.Spec.Resources.VgaConsoleEnabled
res.HardwareClockTimezone = response.Spec.Resources.HardwareClockTimezone
res.DiskList = response.Spec.Resources.DiskList
res.MachineType = response.Spec.Resources.MachineType

nold := make([]*v3.VMNic, len(response.Spec.Resources.NicList))

Expand Down
Loading