diff --git a/Gopkg.lock b/Gopkg.lock index f869e1a..10e9404 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,7 +2,6 @@ [[projects]] - branch = "features/start-servers" name = "github.com/NaverCloudPlatform/ncloud-sdk-go" packages = [ "common", @@ -10,8 +9,8 @@ "request", "sdk" ] - revision = "5fd6750b50f03d491b794e178fe5fce311a721b7" - source = "github.com/stelcheck/ncloud-sdk-go" + revision = "8c64bf395f0bbd113f194df7495cc2eaf8119845" + version = "v1.0.0" [[projects]] name = "github.com/agext/levenshtein" @@ -453,6 +452,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e793e63b7bd1474d98425ca548a795c685189ae9a450bd498a28f0bca983dce9" + inputs-digest = "5e6be4c4dcdd6f0d3160fad63f79f046c4556865077e29352f1ff1179f144698" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 6d19cb0..a58640c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -32,8 +32,3 @@ [prune] go-tests = true unused-packages = true - -[[constraint]] - branch = "features/start-servers" - name = "github.com/NaverCloudPlatform/ncloud-sdk-go" - source = "github.com/stelcheck/ncloud-sdk-go" diff --git a/Services.md b/Services.md index 7d06449..5848330 100644 --- a/Services.md +++ b/Services.md @@ -7,23 +7,23 @@ | 1 | KR | Korea | | 2 | USW | US-West | | 3 | HK | HongKong | -| 4 | SG | Singapore(Old) | -| 5 | JP | Japan | +| 5 | JP | Japan(Old) | | 6 | DE | Germany | | 7 | SGN | Singapore(New) | +| 8 | JPN | Japan(New) | ## Zones | # | Name | Description | | - | ---------- | ------------- | -| 2 | KR-1 | 가산 zone | | 3 | KR-2 | 평촌 zone | +| 2 | KR-1 | 가산 zone | | 10 | USW-1 | 미국 서부 ZONE | | 20 | HK-1 | 홍콩 ZONE | -| 30 | SG-1 | 싱가포르(Old) ZONE | | 40 | JP-1 | 일본 ZONE | | 60 | DE-1 | 독일 ZONE | | 70 | SGN-1 | 싱가포르(New) ZONE | +| 80 | JPN-1 | 일본(New) ZONE | ## Servers (server_product_code) @@ -44,8 +44,6 @@ | SPSVRSTAND000051 | vCPU 8EA, Memory 8GB, Disk 50GB | | SPSVRSTAND000006 | vCPU 8EA, Memory 16GB, Disk 50GB | | SPSVRSTAND000055 | vCPU 8EA, Memory 32GB, Disk 50GB | -| SPSVRSTAND000030 | vCPU 12EA, Memory 16GB, Disk 50GB | -| SPSVRSTAND000022 | vCPU 12EA, Memory 32GB, Disk 50GB | | SPSVRSTAND000053 | vCPU 16EA, Memory 16GB, Disk 50GB | | SPSVRSTAND000046 | vCPU 16EA, Memory 32GB, Disk 50GB | | SPSVRSSD00000003 | vCPU 2EA, Memory 4GB, [SSD]Disk 50GB | @@ -58,8 +56,6 @@ | SPSVRSSD00000006 | vCPU 8EA, Memory 8GB, [SSD]Disk 50GB | | SPSVRSSD00000007 | vCPU 8EA, Memory 16GB, [SSD]Disk 50GB | | SPSVRSSD00000014 | vCPU 8EA, Memory 32GB, [SSD]Disk 50GB | -| SPSVRSSD00000008 | vCPU 12EA, Memory 16GB, [SSD]Disk 50GB | -| SPSVRSSD00000015 | vCPU 12EA, Memory 32GB, [SSD]Disk 50GB | | SPSVRSSD00000009 | vCPU 16EA, Memory 16GB, [SSD]Disk 50GB | | SPSVRSSD00000016 | vCPU 16EA, Memory 32GB, [SSD]Disk 50GB | | SPSVRSTAND000059 | vCPU 8EA, Memory 64GB, Disk 50GB | diff --git a/src/ncloud-products-list/main.go b/src/ncloud-products-list/main.go index ccf0d58..2229bf9 100644 --- a/src/ncloud-products-list/main.go +++ b/src/ncloud-products-list/main.go @@ -9,8 +9,8 @@ import ( ) func main() { - accessKey := os.Getenv("NCLOUD_ACCESS_KEY") - secretKey := os.Getenv("NCLOUD_SECRET_KEY") + accessKey := os.Getenv("NCLOUD_ACCESS_KEY_ID") + secretKey := os.Getenv("NCLOUD_SECRET_ACCESS_KEY") client := sdk.NewConnection(accessKey, secretKey) diff --git a/src/terraform-provider-ncloud/resource_instance.go b/src/terraform-provider-ncloud/resource_instance.go index 948c950..40639a2 100644 --- a/src/terraform-provider-ncloud/resource_instance.go +++ b/src/terraform-provider-ncloud/resource_instance.go @@ -89,9 +89,13 @@ func resourceInstanceCreate(data *schema.ResourceData, meta interface{}) error { createReqParams.ServerImageProductCode = data.Get("server_image_product_code").(string) createReqParams.ServerProductCode = data.Get("server_product_code").(string) createReqParams.LoginKeyName = data.Get("login_keyname").(string) - createReqParams.IsProtectServerTermination = data.Get("termination_protection").(bool) createReqParams.UserData = data.Get("user_data").(string) createReqParams.ServerCreateCount = 1 + createReqParams.IsProtectServerTermination = "false" + + if data.Get("termination_protection").(bool) { + createReqParams.IsProtectServerTermination = "true" + } response, err := client.CreateServerInstances(createReqParams) if err != nil { @@ -166,7 +170,7 @@ func resourceInstanceDelete(data *schema.ResourceData, meta interface{}) error { publicIP := data.Get("public_ip").(string) publicIPReqParams := new(sdk.RequestPublicIPInstanceList) - publicIPReqParams.IsAssociated = true + publicIPReqParams.IsAssociated = "true" publicIPListResponse, err := client.GetPublicIPInstanceList(publicIPReqParams) if err != nil { diff --git a/src/terraform-provider-ncloud/resource_public_ip.go b/src/terraform-provider-ncloud/resource_public_ip.go index 567b5e6..f2f65ac 100644 --- a/src/terraform-provider-ncloud/resource_public_ip.go +++ b/src/terraform-provider-ncloud/resource_public_ip.go @@ -44,6 +44,12 @@ func resourcePublicIP() *schema.Resource { ForceNew: true, Description: "Region number (see https://github.com/Wizcorp/terraform-provider-ncloud/blob/master/Services.md#regions)", }, + "zone_number": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Zone number (see https://github.com/Wizcorp/terraform-provider-ncloud/blob/master/Services.md#regions)", + }, "public_ip": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -58,8 +64,7 @@ func resourcePublicIPCreate(data *schema.ResourceData, meta interface{}) error { reqParams := new(sdk.RequestCreatePublicIPInstance) reqParams.RegionNo = data.Get("region_number").(string) - // API doc says we should be allowed to specify th zone - // reqParams.ZoneNo = serverInfo.Zone.ZoneNo + reqParams.ZoneNo = data.Get("zone_number").(string) ipInfo, err := retryResourcePublicIPCreate(client, reqParams, 5) if err != nil {