terraform-provider-vra icon indicating copy to clipboard operation
terraform-provider-vra copied to clipboard

vra deployment cloudconfig: Inappropriate value for attribute "resources": set of object required.

Open gthieleb opened this issue 1 year ago • 6 comments

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

vRA Version

Version 8.11.2.30052 (21452955)

Terraform Version

Terraform v1.4.0 on linux_amd64

vRA Terraform Provider Version

  • provider registry.terraform.io/hashicorp/random v3.5.1
  • provider registry.terraform.io/vmware/vra v0.7.2

Affected Resource(s)

vra_deployment

Terraform Configuration Files

resource "vra_deployment" "this" {
  name        = var.deployment_name != "" ? var.deployment_name : "deployment-${random_pet.deployment_sfx.id}"
  description = "terraform deployment"

  catalog_item_id      = data.vra_catalog_item.this.id
  project_id           = data.vra_project.this.id

  inputs = {
    environment = "vra"
    vmCount = 1
    ram = 4
    cpuCount = 4
    disks = jsonencode([5, 10])
    backup   = true
    password = local.password
    sshkey = local.sshkey
    nic0 = "private"
    nic1 = "nouplink"
    nic2 = "nouplink"
  }

  resources = {
    vSphere_VM =  {
      properties = {
        cloudConfig = {}
      }
    }
  }

  timeouts {
    create = "30m"
    delete = "30m"
    update = "30m"
  }

  lifecycle {
    ignore_changes = [
      inputs
    ]

  }
}


Expected Behavior

The deployment (Ubuntu/SLES) should be deployed with a custom cloud init configuration.

An example yaml used in vRA deployment blueprint:

resources:
  vSphere_VM:
    properties:
      cloudConfig: |
        users:
          - default
          - name: ${input.username}
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            groups: [wheel, sudo, admin, docker]
            shell: '/bin/bash'
            ssh_authorized_keys:
              - ${input.sshkey}

Actual Behavior

│ Error: Incorrect attribute value type
│
│   on main.tf line 58, in resource "vra_deployment" "this":
│   58:   resources = {
│   59:     vSphere_VM =  {
│   60:       properties = {
│   61:         cloudConfig: {}
│   62:       }
│   63:     }
│   64:   }
│
│ Inappropriate value for attribute "resources": set of object required.

Steps to Reproduce

  1. terraform apply

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

gthieleb avatar May 31 '23 17:05 gthieleb