From 8c204ae802b864f21d85f74b995c5dd0c0ce68bb Mon Sep 17 00:00:00 2001 From: zhaopanju Date: Wed, 27 Mar 2024 14:47:09 +0800 Subject: [PATCH] fix(bms): create bms without security_groups --- docs/resources/bms_instance.md | 3 +-- .../openstack/bms/v1/baremetalservers/requests.go | 6 +++--- huaweicloudstack/services/bms/resource_hcs_bms_instance.go | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/resources/bms_instance.md b/docs/resources/bms_instance.md index c048e72e..c11e3d8e 100644 --- a/docs/resources/bms_instance.md +++ b/docs/resources/bms_instance.md @@ -43,7 +43,6 @@ resource "hcs_bms_instance" "test" { name = var.instance_name image_id = var.image_id flavor_id = var.flavor_id - user_id = var.user_id security_groups = [data.hcs_networking_secgroup.mysecgroup.id] availability_zone = data.hcs_availability_zones.myaz.names[0] vpc_id = data.hcs_vpc.myvpc.id @@ -83,7 +82,7 @@ The following arguments are supported: * `flavor_id` - (Required, String, ForceNew) Specifies the flavor ID of the desired flavor for the instance. Changing this creates a new instance. -* `user_id` - (Required, String, ForceNew) Specifies the user ID. You can obtain the user ID from My Credential on the +* `user_id` - (Optional, String, ForceNew) Specifies the user ID. You can obtain the user ID from My Credential on the management console. Changing this creates a new instance. * `availability_zone` - (Required, String, ForceNew) Specifies the availability zone in which to create the instance. diff --git a/huaweicloudstack/sdk/huaweicloud/openstack/bms/v1/baremetalservers/requests.go b/huaweicloudstack/sdk/huaweicloud/openstack/bms/v1/baremetalservers/requests.go index 133e1594..171a1bf7 100644 --- a/huaweicloudstack/sdk/huaweicloud/openstack/bms/v1/baremetalservers/requests.go +++ b/huaweicloudstack/sdk/huaweicloud/openstack/bms/v1/baremetalservers/requests.go @@ -13,7 +13,7 @@ type CreateOpts struct { Name string `json:"name" required:"true"` - MetaData MetaData `json:"metadata" required:"true"` + MetaData MetaData `json:"metadata"` UserData []byte `json:"-"` @@ -21,7 +21,7 @@ type CreateOpts struct { KeyName string `json:"key_name,omitempty"` - SecurityGroups []SecurityGroup `json:"security_groups,omitempty"` + SecurityGroups []SecurityGroup `json:"security_groups"` Nics []Nic `json:"nics" required:"true"` @@ -41,7 +41,7 @@ type CreateOpts struct { } type MetaData struct { - OpSvcUserId string `json:"op_svc_userid" required:"true"` + OpSvcUserId string `json:"op_svc_userid,omitempty"` BYOL string `json:"BYOL,omitempty"` AdminPass string `json:"admin_pass,omitempty"` AgencyName string `json:"agency_name,omitempty"` diff --git a/huaweicloudstack/services/bms/resource_hcs_bms_instance.go b/huaweicloudstack/services/bms/resource_hcs_bms_instance.go index 0600582d..98b90aaf 100644 --- a/huaweicloudstack/services/bms/resource_hcs_bms_instance.go +++ b/huaweicloudstack/services/bms/resource_hcs_bms_instance.go @@ -56,7 +56,8 @@ func ResourceBmsInstance() *schema.Resource { }, "user_id": { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, ForceNew: true, }, "nics": {