使用Terraform创建Softlayer规格VM实例的相关技术咨询
Great question! Let's break this down clearly for you:
Creating c1/m1 Type Instances with ibm_compute_vm_instance
Absolutely, you can create c1, m1, or any of the predefined VM flavors you see in the Bluemix portal using the ibm_compute_vm_instance Terraform resource. The confusion might come from the fact that the resource supports both custom core/memory configurations and predefined flavor specifications.
Instead of manually setting cores and memory for a custom instance, you can directly specify the predefined flavor code (like c1.1x1, m1.4x16) using the machine_type parameter. Here's a quick example Terraform snippet to create a c1 series instance:
resource "ibm_compute_vm_instance" "c1_example" { hostname = "my-c1-vm" domain = "my-domain.com" datacenter = "dal10" # Use a region available to your account machine_type = "c1.1x1" # Predefined c1 flavor code os_reference_code = "CENTOS_7_64" # Pick your preferred OS ssh_key_ids = [ibm_compute_ssh_key.my_ssh_key.id] }
This will provision exactly the same c1.1x1 instance you see in the Bluemix portal. All predefined flavors (c1, m1, b1, etc.) are supported via the machine_type attribute.
Default CPU Type for Deployments
When deploying instances:
- If you use a predefined flavor like
c1.*orm1.*, the CPU type is tied to that flavor. For most standard c1/m1 instances, this defaults to Intel Xeon processors (typically newer Scalable generations, depending on the datacenter you choose). - If you create a custom instance (by setting
coresandmemoryinstead ofmachine_type), the default CPU is also Intel Xeon. IBM Cloud does offer AMD-based instances, but you'd need to explicitly specify an AMD-specific flavor (e.g.,amd.c1.1x1) to get those.
If you want to confirm the exact CPU type for a running instance, you can check the instance details in the Bluemix portal, or use the IBM Cloud CLI with:
ibmcloud sl hardware detail <your-instance-id>
内容的提问来源于stack exchange,提问作者YuZong Jiang

