Skip to content

Commit

Permalink
convert
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyaming0800 committed Jun 30, 2022
1 parent cbb2cbf commit 95fd994
Show file tree
Hide file tree
Showing 200 changed files with 1,544 additions and 1,544 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# terraform-provider-volcstack
# terraform-provider-volcengine
Terraform Provider
==================
<svg width="313" height="88" viewBox="0 0 313 88" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M98.46 30.46H87.21v-6.72h30.121v6.72h-11.25v33.6h-7.62v-33.6z" fill="#000"></path><path d="M125.291 58.59a30.77 30.77 0 009-1.39l1.15 5.56a31.65 31.65 0 01-10.86 1.88c-9.25 0-12.46-4.3-12.46-11.38v-7.8c0-6.23 2.78-11.49 12.22-11.49 9.44 0 11.56 5.5 11.56 11.85v6.3h-16.32v1.51c0 3.57 1.23 4.96 5.71 4.96zm-5.71-12.4h9.38v-1.46c0-2.78-.85-4.71-4.48-4.71-3.63 0-4.9 1.93-4.9 4.71v1.46zm36.08-5.45a56.603 56.603 0 00-7.81 4.3v19.02h-7.38V34.57h6.23l.49 3.27a32.648 32.648 0 017.74-3.87l.73 6.77zm18.019 0a57.125 57.125 0 00-7.8 4.3v19.02h-7.38V34.57h6.23l.48 3.27a32.764 32.764 0 017.75-3.87l.72 6.77zm24.681 23.32h-6.05l-.54-2a16.153 16.153 0 01-8.77 2.6c-5.39 0-7.69-3.69-7.69-8.77 0-6 2.61-8.29 8.59-8.29h7.08v-3.11c0-3.26-.9-4.41-5.62-4.41-2.747.03-5.484.33-8.17.9l-.91-5.62a38.314 38.314 0 0110.1-1.39c9.26 0 12 3.26 12 10.64l-.02 19.45zm-7.38-11.16h-5.4c-2.42 0-3.09.67-3.09 2.91 0 2 .67 3 3 3 1.95-.03 3.861-.55 5.56-1.51l-.07-4.4zm30.069-25.04a21.154 21.154 0 00-4.24-.49c-2.9 0-3.32 1.27-3.32 3.51v3.69h7.5l-.41 5.87h-7.07v23.62h-7.38V40.44h-4.72v-5.87h4.72v-4.11c0-6.11 2.84-9.14 9.37-9.14a23.496 23.496 0 016.35.85l-.8 5.69zm14.39 36.78c-10.1 0-12.86-5.58-12.86-11.58v-7.48c0-6 2.72-11.61 12.82-11.61s12.83 5.56 12.83 11.61v7.48c.04 6-2.65 11.58-12.79 11.58zm0-24.38c-3.93 0-5.44 1.75-5.44 5.08v7.92c0 3.33 1.51 5.09 5.44 5.09 3.93 0 5.45-1.76 5.45-5.09v-7.92c0-3.28-1.51-5.08-5.45-5.08zm31.82.48a57.125 57.125 0 00-7.8 4.3v19.02h-7.38V34.57h6.23l.48 3.27a32.943 32.943 0 017.79-3.87l.68 6.77zm20.32 23.32v-20.6c0-1.57-.67-2.36-2.36-2.36s-5 1.09-7.68 2.49v20.47h-7.39V34.57h5.63l.73 2.48a29.593 29.593 0 0111.79-3.08c2.85 0 4.6 1.15 5.57 3.14a29.004 29.004 0 0111.86-3.14c4.9 0 6.65 3.44 6.65 8.71v21.38H305v-20.6c0-1.57-.67-2.36-2.36-2.36a19.425 19.425 0 00-7.68 2.49v20.47h-7.38z" fill="#000"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16.55l19.1 11.03v22.06L21.2 38.61V16.55zm21.19 11.03v22.06L61.5 38.61V16.55L42.39 27.58zM0 4.24V26.3l19.1 11.03V15.27L0 4.24zm21.2 58.85l19.1 11.03V52.06L21.2 41.03v22.06z" fill="#7B42BC"></path></svg>
Expand All @@ -15,32 +15,32 @@ Requirements
- [Go](https://golang.org/doc/install) 1.13 (to build the provider plugin)


# Vestack Provider
# Volcengine Provider

The Vestack provider is used to interact with many resources supported by [Vestack](https://www.volcengine.com/).
The Volcengine provider is used to interact with many resources supported by [Volcengine](https://www.volcengine.com/).
The provider needs to be configured with the proper credentials before it can be used.

Use the navigation on the left to read about the available resources.

-> **Note:** This guide requires an available Vestack account or sub-account with project to create resources.
-> **Note:** This guide requires an available Volcengine account or sub-account with project to create resources.

## Example Usage
```hcl
# Configure the Vestack Provider
provider "vestack" {
# Configure the Volcengine Provider
provider "volcengine" {
access_key = "your ak"
secret_key = "your sk"
session_token = "sts token"
region = "cn-beijing"
}
# Query Vpc
data "vestack_vpcs" "default"{
data "volcengine_vpcs" "default"{
ids = ["vpc-mizl7m1kqccg5smt1bdpijuj"]
}
#Create vpc
resource "vestack_vpc" "foo" {
resource "volcengine_vpc" "foo" {
vpc_name = "tf-test-1"
cidr_block = "172.16.0.0/16"
dns_servers = ["8.8.8.8","114.114.114.114"]
Expand All @@ -50,7 +50,7 @@ resource "vestack_vpc" "foo" {

## Authentication

The Vestack provider offers a flexible means of providing credentials for
The Volcengine provider offers a flexible means of providing credentials for
authentication. The following methods are supported, in this order, and
explained below:

Expand All @@ -60,12 +60,12 @@ explained below:
### Static credentials

Static credentials can be provided by adding an `public_key` and `private_key` in-line in the
vestack provider block:
volcengine provider block:

Usage:

```hcl
provider "vestack" {
provider "volcengine" {
access_key = "your ak"
secret_key = "your sk"
region = "cn-beijing"
Expand All @@ -74,22 +74,22 @@ provider "vestack" {

### Environment variables

You can provide your credentials via `VESTACK_ACCESS_KEY` and `VESTACK_SECRET_KEY`
environment variables, representing your vestack public key and private key respectively.
`VESTACK_REGION` is also used, if applicable:
You can provide your credentials via `VOLCENGINE_ACCESS_KEY` and `VOLCENGINE_SECRET_KEY`
environment variables, representing your volcengine public key and private key respectively.
`VOLCENGINE_REGION` is also used, if applicable:

```hcl
provider "vestack" {
provider "volcengine" {
}
```

Usage:

```hcl
$ export VESTACK_ACCESS_KEY="your_public_key"
$ export VESTACK_SECRET_KEY="your_private_key"
$ export VESTACK_REGION="cn-beijing"
$ export VOLCENGINE_ACCESS_KEY="your_public_key"
$ export VOLCENGINE_SECRET_KEY="your_private_key"
$ export VOLCENGINE_REGION="cn-beijing"
$ terraform plan
```

Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
OS=$1
NAME="terraform-provider-vestack"
NAME="terraform-provider-volcengine"
set -ea

if [ "$OS" == "" ]
Expand All @@ -15,8 +15,8 @@ cp $NAME $GOPATH/bin/
# 需要执行如下三条指令 来映射CLI到本地路径
# 如果小于此版本可以不做这三个操作
# shellcheck disable=SC2154
#mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/vestack/0.0.1/"$OS"_amd64/
#rm -f ~/.terraform.d/plugins/registry.terraform.io/hashicorp/vestack/0.0.1/"$OS"_amd64/"$NAME"_v0.0.1
#cp $NAME ~/.terraform.d/plugins/registry.terraform.io/hashicorp/vestack/0.0.1/"$OS"_amd64/"$NAME"_v0.0.1
#mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_amd64/
#rm -f ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_amd64/"$NAME"_v0.0.1
#cp $NAME ~/.terraform.d/plugins/registry.terraform.io/hashicorp/volcengine/0.0.1/"$OS"_amd64/"$NAME"_v0.0.1

rm -f $NAME
2 changes: 1 addition & 1 deletion build_scm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LINUX_SUPPORT_GOARCH=("386" "amd64" "arm64" "arm")
MAC_SUPPORT_GOARCH=("amd64" "arm64")
WIN_SUPPORT_GOARCH=("386" "amd64")

NAME="terraform-provider-vestack"
NAME="terraform-provider-volcengine"
set -ea

for goos in "${SUPPORT_GOOS[@]}"
Expand Down
27 changes: 0 additions & 27 deletions common/common_vestack_client.go

This file was deleted.

File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions common/common_volcengine_client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package common

import (
"github.com/volcengine/volcengine-go-sdk/service/autoscaling"
"github.com/volcengine/volcengine-go-sdk/service/clb"
"github.com/volcengine/volcengine-go-sdk/service/ecs"
"github.com/volcengine/volcengine-go-sdk/service/natgateway"
"github.com/volcengine/volcengine-go-sdk/service/rdsmysql"
"github.com/volcengine/volcengine-go-sdk/service/rdsmysqlv2"
"github.com/volcengine/volcengine-go-sdk/service/storageebs"
"github.com/volcengine/volcengine-go-sdk/service/vpc"
"github.com/volcengine/volcengine-go-sdk/service/vpn"
)

type SdkClient struct {
Region string
VpcClient *vpc.VPC
ClbClient *clb.CLB
EcsClient *ecs.ECS
EbsClient *storageebs.STORAGEEBS
NatClient *natgateway.NATGATEWAY
VpnClient *vpn.VPN
AutoScalingClient *autoscaling.AUTOSCALING
RdsClient *rdsmysql.RDSMYSQL
RdsClientV2 *rdsmysqlv2.RDSMYSQLV2
UniversalClient *Universal
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package common
import (
"fmt"

"github.com/volcengine/volcstack-go-sdk/service/autoscaling"
"github.com/volcengine/volcstack-go-sdk/service/clb"
"github.com/volcengine/volcstack-go-sdk/service/ecs"
"github.com/volcengine/volcstack-go-sdk/service/natgateway"
"github.com/volcengine/volcstack-go-sdk/service/rdsmysql"
"github.com/volcengine/volcstack-go-sdk/service/rdsmysqlv2"
"github.com/volcengine/volcstack-go-sdk/service/storageebs"
"github.com/volcengine/volcstack-go-sdk/service/vpc"
"github.com/volcengine/volcstack-go-sdk/service/vpn"
"github.com/volcengine/volcstack-go-sdk/volcstack"
"github.com/volcengine/volcstack-go-sdk/volcstack/credentials"
"github.com/volcengine/volcstack-go-sdk/volcstack/session"
"github.com/volcengine/volcstack-go-sdk/volcstack/volcstackutil"
"github.com/volcengine/volcengine-go-sdk/service/autoscaling"
"github.com/volcengine/volcengine-go-sdk/service/clb"
"github.com/volcengine/volcengine-go-sdk/service/ecs"
"github.com/volcengine/volcengine-go-sdk/service/natgateway"
"github.com/volcengine/volcengine-go-sdk/service/rdsmysql"
"github.com/volcengine/volcengine-go-sdk/service/rdsmysqlv2"
"github.com/volcengine/volcengine-go-sdk/service/storageebs"
"github.com/volcengine/volcengine-go-sdk/service/vpc"
"github.com/volcengine/volcengine-go-sdk/service/vpn"
"github.com/volcengine/volcengine-go-sdk/volcengine"
"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"
"github.com/volcengine/volcengine-go-sdk/volcengine/session"
"github.com/volcengine/volcengine-go-sdk/volcengine/volcengineutil"
)

type Config struct {
Expand All @@ -31,12 +31,12 @@ func (c *Config) Client() (*SdkClient, error) {
var client SdkClient
version := fmt.Sprintf("%s/%s", TerraformProviderName, TerraformProviderVersion)

config := volcstack.NewConfig().
config := volcengine.NewConfig().
WithRegion(c.Region).
WithExtraUserAgent(volcstack.String(version)).
WithExtraUserAgent(volcengine.String(version)).
WithCredentials(credentials.NewStaticCredentials(c.AccessKey, c.SecretKey, c.SessionToken)).
WithDisableSSL(c.DisableSSL).
WithEndpoint(volcstackutil.NewEndpoint().WithCustomerEndpoint(c.Endpoint).GetEndpoint())
WithEndpoint(volcengineutil.NewEndpoint().WithCustomerEndpoint(c.Endpoint).GetEndpoint())

sess, err := session.NewSession(config)
if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package common
import (
"strings"

"github.com/volcengine/volcstack-go-sdk/volcstack/volcstackerr"
"github.com/volcengine/volcengine-go-sdk/volcengine/volcengineerr"
)

func ResourceNotFoundError(err error) bool {
if e, ok := err.(volcstackerr.RequestFailure); ok && e.StatusCode() == 404 {
if e, ok := err.(volcengineerr.RequestFailure); ok && e.StatusCode() == 404 {
return true
}
errMessage := strings.ToLower(err.Error())
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package common

import (
"github.com/volcengine/volcstack-go-sdk/volcstack/client"
"github.com/volcengine/volcstack-go-sdk/volcstack/client/metadata"
"github.com/volcengine/volcstack-go-sdk/volcstack/corehandlers"
"github.com/volcengine/volcstack-go-sdk/volcstack/request"
"github.com/volcengine/volcstack-go-sdk/volcstack/session"
"github.com/volcengine/volcstack-go-sdk/volcstack/signer/volc"
"github.com/volcengine/volcstack-go-sdk/volcstack/volcstackquery"
"github.com/volcengine/volcengine-go-sdk/volcengine/client"
"github.com/volcengine/volcengine-go-sdk/volcengine/client/metadata"
"github.com/volcengine/volcengine-go-sdk/volcengine/corehandlers"
"github.com/volcengine/volcengine-go-sdk/volcengine/request"
"github.com/volcengine/volcengine-go-sdk/volcengine/session"
"github.com/volcengine/volcengine-go-sdk/volcengine/signer/volc"
"github.com/volcengine/volcengine-go-sdk/volcengine/volcenginequery"
)

type HttpMethod int
Expand Down Expand Up @@ -61,10 +61,10 @@ func (u *Universal) newTargetClient(svc string, version string) *client.Client {
c.Handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler)
c.Handlers.Build.PushBackNamed(corehandlers.AddHostExecEnvUserAgentHandler)
c.Handlers.Sign.PushBackNamed(volc.SignRequestHandler)
c.Handlers.Build.PushBackNamed(volcstackquery.BuildHandler)
c.Handlers.Unmarshal.PushBackNamed(volcstackquery.UnmarshalHandler)
c.Handlers.UnmarshalMeta.PushBackNamed(volcstackquery.UnmarshalMetaHandler)
c.Handlers.UnmarshalError.PushBackNamed(volcstackquery.UnmarshalErrorHandler)
c.Handlers.Build.PushBackNamed(volcenginequery.BuildHandler)
c.Handlers.Unmarshal.PushBackNamed(volcenginequery.UnmarshalHandler)
c.Handlers.UnmarshalMeta.PushBackNamed(volcenginequery.UnmarshalMetaHandler)
c.Handlers.UnmarshalError.PushBackNamed(volcenginequery.UnmarshalErrorHandler)

return c
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

const (
TerraformProviderName = "terraform-provider-vestack"
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.5"
)
10 changes: 5 additions & 5 deletions docgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/fatih/color"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/volcengine/terraform-provider-vestack/common"
ve "github.com/volcengine/terraform-provider-vestack/vestack"
"github.com/volcengine/terraform-provider-volcengine/common"
ve "github.com/volcengine/terraform-provider-volcengine/volcengine"
)

const (
Expand Down Expand Up @@ -87,11 +87,11 @@ In addition to all arguments above, the following attributes are exported:
)

const (
cloudMark = "vestack"
cloudTitle = "Vestack"
cloudMark = "volcengine"
cloudTitle = "Volcengine"
cloudPrefix = cloudMark + "_"
docRoot = "/website"
providerRoot = "/vestack"
providerRoot = "/volcengine"
exampleRoot = "/example"
)

Expand Down
2 changes: 1 addition & 1 deletion example/acl/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "vestack_acl" "foo" {
resource "volcengine_acl" "foo" {
acl_name = "tf-test-2"
acl_entries {
entry = "172.20.1.0/24"
Expand Down
6 changes: 3 additions & 3 deletions example/aclEntry/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resource "vestack_acl" "foo" {
resource "volcengine_acl" "foo" {
acl_name = "tf-test-3"
description = "tf-test"
}

resource "vestack_acl_entry" "foo" {
acl_id = vestack_acl.foo.id
resource "volcengine_acl_entry" "foo" {
acl_id = volcengine_acl.foo.id
description = "tf acl entry desc demo"
entry = "192.2.2.1/32"
}
2 changes: 1 addition & 1 deletion example/certificate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variable "certificate" {
})
}

resource "vestack_certificate" "foo" {
resource "volcengine_certificate" "foo" {
certificate_name = "demo-certificate"
description = "This is a clb certificate"
public_key = var.certificate.public_key
Expand Down
2 changes: 1 addition & 1 deletion example/clb/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "vestack_clb" "foo" {
resource "volcengine_clb" "foo" {
type = "public"
subnet_id = "subnet-2744i7u9alnnk7fap8tkq8aft"
load_balancer_spec = "small_1"
Expand Down
2 changes: 1 addition & 1 deletion example/dataAcls/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_acls" "default"{
data "volcengine_acls" "default"{
ids = ["acl-3ti8n0rurx4bwbh9jzdy"]
}
2 changes: 1 addition & 1 deletion example/dataCertificates/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_certificates" "default" {
data "volcengine_certificates" "default" {
ids = ["cert-274scdwqufwg07fap8u5fu8pi"]
}
2 changes: 1 addition & 1 deletion example/dataClbs/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_clbs" "default"{
data "volcengine_clbs" "default"{
ids = ["clb-273y2ok6ets007fap8txvf6us"]
}
2 changes: 1 addition & 1 deletion example/dataEcsInstances/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_ecs_instances" "foo" {
data "volcengine_ecs_instances" "foo" {
ids = ["i-ebgy6xmgjve0384ncgsc"]
}
2 changes: 1 addition & 1 deletion example/dataEipAddresses/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_eip_addresses" "default"{
data "volcengine_eip_addresses" "default"{
ids = ["eip-2748mbpjqzhfk7fap8teu0k1a"]
}
2 changes: 1 addition & 1 deletion example/dataImages/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_images" "default" {
data "volcengine_images" "default" {
ids = ["image-cm9ssb4eqmhdas306zlp", "image-ybkzct2rtj4ay5rmlfc3"]
}
2 changes: 1 addition & 1 deletion example/dataListeners/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "vestack_listeners" "default" {
data "volcengine_listeners" "default" {
ids = ["lsn-273yv0mhs5xj47fap8sehiiso", "lsn-273yw6zps6pz47fap8swa0q2z"]
}
Loading

0 comments on commit 95fd994

Please sign in to comment.