IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
341 stars 669 forks source link

Expected only one oneOf fields to be set: got 0 #5507

Closed shreejam21 closed 4 months ago

shreejam21 commented 4 months ago

Community Note

Terraform CLI and Terraform IBM Provider Version

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
resource "ibm_is_instance" "vpcinstance" {
  name           = var.name
  vpc            = var.vpc_id
  zone           = data.ibm_is_subnet.subnet.zone
  profile        = var.profile_name
  image          = data.ibm_is_image.image.id
  keys           = var.ssh_key_ids
  resource_group = var.resource_group_id
  # If you want to pass user data to the instance upon creation this is the code to add that to your terraform script.
  #user_data = var.init_script != "" ? var.init_script : file("${path.module}/init-script-ubuntu.sh")
  user_data                        = var.user_data
  access_tags                      = var.access_tags
  auto_delete_volume               = var.all_auto_delete_volume
  availability_policy_host_failure = var.availability_policy_host_failure
  instance_template                = var.instance_template
  dedicated_host                   = var.dedicated_host
  dedicated_host_group             = var.dedicated_host_group
  placement_group                  = var.placement_group
  total_volume_bandwidth           = var.total_volume_bandwidth

  #ConfidentiaL Compute Mode (This feature is SELECT AVAILABILITY. Right now SGX is only available in "US South (Dallas)" Region)
  confidential_compute_mode        = var.confidential_compute_mode
  enable_secure_boot               = var.confidential_compute_mode == "sgx" ? true : false

  primary_network_interface {
    name              = "eth1"
    subnet            = data.ibm_is_subnet.subnet.id
    allow_ip_spoofing = false
    security_groups   = [ibm_is_security_group.vpcinstance.id]
  }

  timeouts {
    create = "15m"
    update = "15m"
    delete = "15m"
  }
  # Names the disk volume the same as the VM instance name
  boot_volume {
    name               = "${var.name}-boot"
    auto_delete_volume = var.boot_volume_auto_delete_volume
    encryption         = var.boot_volume_encryption
    size               = var.boot_volume_size
    tags               = var.tags
  }

  volumes = length(var.volumes) > 0 ? [for vol in ibm_is_volume.volumes : vol.id] : null
  tags    = var.tags

}
# please share a link to the ZIP file.

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

shreejam21 commented 4 months ago

Error Description

Error: Expected only one oneOf fields to be set: got 0
│
│   with module.ibm_is_instance.ibm_is_instance.vpcinstance,
│   on ..\..\main.tf line 53, in resource "ibm_is_instance" "vpcinstance":
│   53: resource "ibm_is_instance" "vpcinstance" {
│
│ ---
│ id: terraform-cc6801cd
│ summary: 'Expected only one oneOf fields to be set: got 0'
│ severity: error
│ resource: ibm_is_instance
│ operation: create
│ component:
│   name: github.com/IBM-Cloud/terraform-provider-ibm
│   version: 1.67.1
│ ---
shreejam21 commented 4 months ago

Please help !

deepaksibm commented 4 months ago

@shreejam21 Could you please enable the Debug logs and share it ? export TF_LOG=Debug terraform apply

shreejam21 commented 4 months ago

Its resolved - it was typo !