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

Error Using 'data_source_reference' attribute for 'nutanix_image' resource #652

Open
tbeConfo opened this issue Nov 28, 2023 · 0 comments
Open

Comments

@tbeConfo
Copy link

Nutanix Cluster Information

  • Version pc.2022.6.0.8
  • NCC Version: 4.6.0
  • LCM Version: 2.4.3.1

Terraform Version

  • OS Debian 11.8
  • Terraform v1.6.4 on linux_amd64
  • provider registry.terraform.io/nutanix/nutanix v1.9.4

Affected Resource(s)

  • nutanix_image

Terraform Configuration Files

terraform {
  required_providers {
    nutanix = {
      source = "nutanix/nutanix"
      version = "1.9.4"
    }
  }
}

provider "nutanix" {
  username     = var.nutanix_username
  password     = var.nutanix_password
  endpoint     = var.nutanix_endpoint
  port         = var.nutanix_endpoint_port
  insecure     = true
  wait_timeout = 10
}

resource "nutanix_image" "test" {
  name        = "linux-img--SCSI.0-1"
  description = "Linux img"

  data_source_reference = {
    kind = "vm_disk"
    uuid = "b62dbfa7-f19b-440a-938c-e28ea3c98d21"
  }
  image_type = "DISK_IMAGE"
  architecture = "X86_64"

  initial_placement_ref_list = [
    { kind = "cluster"
      uuid = "000608ae-3fc3-9376-62f5-0894efbcc894"
    }
  ]
}

Debug Output

Panic Output

Expected Behavior

The image creation process should be successful via Terraform as is the attributes supported by the REST API in version 3.
This should be supported as it is indicated in the documentation for the 'nutanix_image' resource:

curl -X 'POST' \
  'https://prismCentral:9440/api/nutanix/v3/images' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-Nutanix-Client-Type: ui' \
  -d '{
        "spec":{
          "name":"linux-img--SCSI.0-1",
          "resources":{
            "image_type":"DISK_IMAGE",
            "data_source_reference":{
              "kind":"vm_disk",
              "uuid":"b62dbfa7-f19b-440a-938c-e28ea3c98d21"
            },
            "initial_placement_ref_list":[
              {
                "kind":"cluster",
                "uuid":"000608ae-3fc3-9376-62f5-0894efbcc894"
              }
            ]
          }
        },
        "metadata":{
          "kind":"image"
        },
        "api_version":"3.1.0"
      }'
}

Actual Behavior

│ Error: Unsupported argument

│ on main.tf line 23, in resource "nutanix_image" "test":
│ 23: data_source_reference = {

│ An argument named "data_source_reference" is not expected here.


│ Error: Unsupported argument

│ on main.tf line 30, in resource "nutanix_image" "test":
│ 30: initial_placement_ref_list = [

│ An argument named "initial_placement_ref_list" is not expected here.

However, it's worth noting that the 'initial_placement_ref_list' attribute is not mentioned in the documentation even though it is equally important when importing a 'VM_DISK' source image into the location of its placement method.

Steps to Reproduce

  1. terraform apply

Important Factors

This issue has already been addressed in 'Provider needs to support data_source_reference attribute for nutanix_image resource' (#52) and is supposed to be fixed in 'Add missing API fields for structs' (#80)."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant