oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
760 stars 683 forks source link

400-InvalidParameter, Shape is not valid for image #2103

Open ngochieu642 opened 6 months ago

ngochieu642 commented 6 months ago

Community Note

Terraform Version and Provider Version

terraform -v
Terraform v1.5.7
on linux_amd64
+ provider registry.terraform.io/oracle/oci v5.38.0

Affected Resource(s)

Terraform Configuration Files

variable "ubuntu_22_04" {
  description = "OS image for Ubuntu 22.04"
  default     = "ocid1.image.oc1.uk-london-1.aaaaaaaaah4o6bubxrmqgocs6fdj3bxlnkb4wqqaruffaaodk2eigubu6g4q"
}

resource "oci_core_instance" "my_vm" {
  availability_domain = local.ad
  compartment_id      = local.compartment_id
  shape               = var.vm_shape["shape"]

  shape_config {
    ocpus         = var.vm_shape["ocpus"]
    memory_in_gbs = var.vm_shape["memory"]
  }

  source_details {
    source_type             = "image"
    boot_volume_size_in_gbs = var.vm_shape["boot_volume_size"]
    source_id = var.ubuntu_22_04
  }

  # Optional
  create_vnic_details {
    assign_public_ip = false
    subnet_id        = oci_core_subnet.my_private_subnet.id
  }
  metadata = {
    ssh_authorized_keys = join("\n", local.authorized_keys)
  }
}

Debug Output

Panic Output

Expected Behavior

Actual Behavior

╷
│ Error: 400-InvalidParameter, Shape BM.Standard.E5.192 is not valid for image ocid1.image.oc1.uk-london-1.aaaaaaaaah4o6bubxrmqgocs6fdj3bxlnkb4wqqaruffaaodk2eigubu6g4q.
│ Suggestion: Please update the parameter(s) in the Terraform config as per error message Shape BM.Standard.E5.192 is not valid for image ocid1.image.oc1.uk-london-1.aaaaaaaaah4o6bubxrmqgocs6fdj3bxlnkb4wqqaruffaaodk2eigubu6g4q.
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_instance 
│ API Reference: https://docs.oracle.com/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance 
│ Request Target: POST https://iaas.uk-london-1.oraclecloud.com/20160918/instances 
│ Provider version: 5.38.0, released on 2024-04-21. This provider is 1 Update(s) behind to current. 
│ Service: Core Instance 
│ Operation Name: LaunchInstance 
│ OPC request ID: a7858b681070854fa11c5f36f30df90c/29250AC99FCD75D10C401DD84B215807/66C78334E2F1BB12ED1551C323670A6D 
│ 
│ 
│   with module.sam_3TB.oci_core_instance.my_vm,
│   on sam_3TB/compute.tf line 202, in resource "oci_core_instance" "my_vm":
│  202: resource "oci_core_instance" "my_vm" {
│ 

Steps to Reproduce

  1. terraform apply

Important Factoids

References

https://docs.oracle.com/en-us/iaas/Content/Compute/known-issues.htm#a1-image-name-terraform