Skip to content

OCI CLI ignores shape-config memory_in_gbs parameter for Flex shapes, always uses default memory allocation #986

@timmcfadden

Description

@timmcfadden

Bug Description:

Summary

The OCI CLI compute instance launch command completely ignores the memory_in_gbs parameter in --shape-config for Flex shapes (VM.Standard.E4.Flex,
VM.Standard3.Flex, VM.Standard.A1.Flex), always defaulting to the shape's default memory allocation regardless of the specified value.

Environment

  • OCI CLI Version: 3.64.1 (Oracle-PythonCLI/3.64.1)
  • Platform: Linux 6.12.0-102.36.5.2.el9uek.x86_64
  • Region: us-ashburn-1 (iad)
  • Shapes Tested: VM.Standard.E4.Flex, VM.Standard3.Flex, VM.Standard.A1.Flex

Expected Behavior

When launching an instance with --shape-config '{"ocpus": 2, "memory_in_gbs": 4}', the instance should be created with exactly 4 GB of memory.

Actual Behavior

The instance is created with the shape's default memory allocation:

  • VM.Standard.E4.Flex: Always gets 32 GB (16 GB per OCPU default)
  • VM.Standard3.Flex: Always gets 32 GB (16 GB per OCPU default)
  • VM.Standard.A1.Flex: Always gets 12 GB (6 GB per OCPU default)

Steps to Reproduce

  1. Launch instance with JSON inline:
    oci compute instance launch
    --compartment-id [COMPARTMENT_ID]
    --availability-domain [AD]
    --display-name "test-memory-4gb"
    --image-id [COMPATIBLE_IMAGE_ID]
    --subnet-id [SUBNET_ID]
    --shape VM.Standard.E4.Flex
    --shape-config '{"ocpus": 2, "memory_in_gbs": 4}'

  2. Launch instance with JSON file:
    echo '{"ocpus": 2, "memory_in_gbs": 4}' > shape-config.json
    oci compute instance launch
    --shape VM.Standard.E4.Flex
    --shape-config file://shape-config.json
    [other parameters...]

  3. Attempt resize on stopped instance:
    oci compute instance update
    --instance-id [INSTANCE_ID]
    --shape-config file://shape-config.json --force

  4. Verify memory allocation:
    oci compute instance get
    --instance-id [INSTANCE_ID]
    --query 'data.shape_config.memory_in_gbs'

Result: All methods return default memory (32.0 GB for E4.Flex) instead of requested 4 GB.

Workaround

Using Terraform with the OCI provider correctly allocates the specified memory:
resource "oci_core_instance" "test" {
shape = "VM.Standard.E4.Flex"
shape_config {
ocpus = 2
memory_in_gbs = 4 # This works correctly
}
}

Impact

  • High: Prevents accurate resource provisioning for migration and automation scenarios
  • Cost: Forces over-allocation of memory resources leading to unnecessary costs
  • Automation: Breaks infrastructure-as-code deployments that require specific memory configurations

Additional Evidence

  • Shape constraints confirm memory_in_gbs range is valid (min: 1.0, max: 64.0 per OCPU for E4.Flex)
  • Work requests complete successfully but memory allocation remains unchanged
  • Issue persists across multiple regions and image types
  • Same JSON configuration works correctly with Terraform OCI provider

This appears to be a CLI-specific issue where the shape-config memory parameter is not being properly passed to the underlying API, while the
Terraform provider correctly implements the same functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions