From eb62c9f7773d153c4bf1b68ee9888747ebe66b96 Mon Sep 17 00:00:00 2001 From: tunm4 <8-tunm4_2@users.noreply.git.vngcloud.dev> Date: Mon, 26 Feb 2024 16:55:19 +0700 Subject: [PATCH] add poc field --- build.sh | 2 +- client/vserver/model_create_server_request.go | 2 ++ client/vserver/model_create_volume_request.go | 2 ++ docs/resources/vserver_server.md | 1 + docs/resources/vserver_volume.md | 1 + resource/vserver/resource_server.go | 6 ++++++ resource/vserver/resource_volume.go | 6 ++++++ 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 646bda0..1d25ddb 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ rm -rf .terraform rm -r .terraform.lock.hcl go build -o terraform-provider-vngcloud #OS_ARCH="$(go env GOHOSTOS)_$(go env GOHOSTARCH)" -OS_ARCH="linux_amd64" +OS_ARCH="darwin_amd64" echo $OS_ARCH #rm -rf ~/.terraform.d/plugins/vngcloud.vn/terraform/vngcloud/0.2 #mkdir -p ~/.terraform.d/plugins/vngcloud.vn/terraform/vngcloud/0.2/$OS_ARCH diff --git a/client/vserver/model_create_server_request.go b/client/vserver/model_create_server_request.go index 8683fc1..6735c7d 100644 --- a/client/vserver/model_create_server_request.go +++ b/client/vserver/model_create_server_request.go @@ -58,4 +58,6 @@ type CreateServerRequest struct { UserPassword string `json:"userPassword,omitempty"` // Zone of flavor. You can choose if having multiple zone HostGroupId string `json:"hostGroupId,omitempty"` + // is POC + IsPoc bool `json:"isPoc,omitempty"` } diff --git a/client/vserver/model_create_volume_request.go b/client/vserver/model_create_volume_request.go index a542020..54d018c 100644 --- a/client/vserver/model_create_volume_request.go +++ b/client/vserver/model_create_volume_request.go @@ -23,4 +23,6 @@ type CreateVolumeRequest struct { Size int32 `json:"size"` // Id of volume type VolumeTypeId string `json:"volumeTypeId"` + // is POC + IsPoc bool `json:"isPoc,omitempty"` } diff --git a/docs/resources/vserver_server.md b/docs/resources/vserver_server.md index 00ec8c6..1523adb 100644 --- a/docs/resources/vserver_server.md +++ b/docs/resources/vserver_server.md @@ -56,6 +56,7 @@ The following arguments are supported: - **server_group** (String, Optional) ID of Server Group. - **user_data** (String, Optional) User data to provide when launching the server. - **user_data_base64_encode** (Boolean, Optional) Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. +- **is_poc** (Boolean, Optional) Is Poc Resource. ## Attributes Reference diff --git a/docs/resources/vserver_volume.md b/docs/resources/vserver_volume.md index a217909..a8e2090 100644 --- a/docs/resources/vserver_volume.md +++ b/docs/resources/vserver_volume.md @@ -33,6 +33,7 @@ The following arguments are supported: - **volume_type_id** (String, Required) ID of Volume's Type - **encryption_type** (String, Optional) Type encryption of volume. - **multi_attach** (Boolean, Optional) Specifies whether to enable Volume Multi-Attach. +- **is_poc** (Boolean, Optional) Is Poc Resource. ## Attributes Reference diff --git a/resource/vserver/resource_server.go b/resource/vserver/resource_server.go index 52f0e83..6f003a6 100644 --- a/resource/vserver/resource_server.go +++ b/resource/vserver/resource_server.go @@ -174,6 +174,11 @@ func ResourceServer() *schema.Resource { Optional: true, ForceNew: true, }, + "is_poc": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, }, } } @@ -237,6 +242,7 @@ func resourceServerCreate(d *schema.ResourceData, m interface{}) error { UserData: d.Get("user_data").(string), UserDataBase64Encoded: d.Get("user_data_base64_encode").(bool), HostGroupId: d.Get("host_group_id").(string), + IsPoc: d.Get("is_poc").(bool), } cli := m.(*client.Client) resp, httpResponse, err := cli.VserverClient.ServerRestControllerApi.CreateServerUsingPOST1(context.TODO(), server, projectID) diff --git a/resource/vserver/resource_volume.go b/resource/vserver/resource_volume.go index 68d80ef..b8e28b3 100644 --- a/resource/vserver/resource_volume.go +++ b/resource/vserver/resource_volume.go @@ -67,6 +67,11 @@ func ResourceVolume() *schema.Resource { Optional: true, ForceNew: true, }, + "is_poc": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + }, }, } } @@ -92,6 +97,7 @@ func resourceVolumeCreate(d *schema.ResourceData, m interface{}) error { Size: int32(d.Get("size").(int)), VolumeTypeId: d.Get("volume_type_id").(string), MultiAttach: d.Get("multi_attach").(bool), + IsPoc: d.Get("is_poc").(bool), } cli := m.(*client.Client) resp, httpResponse, err := cli.VserverClient.VolumeRestControllerApi.CreateVolumeUsingPOST1(context.TODO(), a, projectID)