Skip to content

Getting an error message "produced an unexpected new value: .object: wrong final value type: incorrect │ object attributes." #2747

@KraimABD

Description

@KraimABD

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.12.2
Kubernetes provider version: registry.terraform.io/hashicorp/kubernetes v2.37.1
Kubernetes version: "v1.29.6+aba1e8d" using Openshift "4.16.4"

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "~> 2.11"
    }
  }
}

provider "kubernetes" {
  config_path = "~/.kube/config"
}

resource "kubernetes_secret" "my_vmi_secret" {
  metadata {
    name = "my-vmi-secret"
  }

  data = {
    userdata = base64decode("IyMjIyMjIyM....ro=")
  }
}


resource "kubernetes_manifest" "my_resources" {
  manifest = yamldecode(file("manifest.yaml"))
}

manifest.yaml

apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: rhel-pinned
  namespace: default
spec:
  dataVolumeTemplates:
  - apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
    metadata:
      name: rhel-pinned-dv
    spec:
      source:
        registry:
          url: "docker://quay-xxx-qcow2:latest"
          pullMethod: node
      accessModes: ReadWriteMany
      storage:
        resources:
          requests:
            storage: 50Gi
  running: true
  template:
    metadata:
      labels:
        net: xxx
      annotations:
        userspace/mapped-dir: /var/run/xxx-sockets/
        cpu-load-balancing.crio.io: disable 
        cpu-quota.crio.io: disable 
        irq-load-balancing.crio.io: disable 
    spec:
      domain:
        cpu:
          sockets: 1
          cores: 1
          threads: 1
          dedicatedCpuPlacement: true
          isolateEmulatorThread: true
        devices:
          disks:
            - name: rootdisk
              disk:
                bus: virtio
            - name: cloudinitdisk
              disk:
                bus: virtio
          interfaces:
          - binding:
              name: vhostuser
            macAddress: 00:16:3e:00:00:01
            name: vxlannet-1
          networkInterfaceMultiqueue: true
          rng: {}
        features:
          acpi: {}
          smm:
            enabled: true
        firmware:
          bootloader:
            bios: {}
        memory:
          guest: 2Gi # represents the memory allocated to the VM and must be an integer.
          hugepages:
            pageSize: 1Gi # The only supported page size is 1Gi.
        resources:
          requests:
            xxx-dataplane.io/sockets: 1
          limits:
            xxx-dataplane.io/sockets: 1
      networks:
      - multus:
          networkName: vxlan-1102
        name: vxlannet-1
      volumes:
        - name: rootdisk
          dataVolume:
            name: rhel-pinned-dv
        - name: cloudinitdisk
          cloudInitNoCloud:
            secretRef:
              name: my-vmi-secret

Steps to Reproduce

$ terraform init
$ terraform apply

Expected Behavior

To not show the error, because the whole infra is deployed successfully but on the cli it shows the following error

Image

Actual Behavior

What actually happened?
Successfully applied the manifest and created the target infrastructure, but on the cli shows an error

Important Factoids

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions