Skip to content

Commit

Permalink
Merge branch 'trunk' into autodoc
Browse files Browse the repository at this point in the history
# Conflicts:
#	ksyun/resource_ksyun_eip.go
  • Loading branch information
x6doooo committed Dec 29, 2022
2 parents 6ce263c + f30378a commit 5511019
Show file tree
Hide file tree
Showing 21 changed files with 342 additions and 180 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 1.3.62 (Dec 29, 2022)

BUG FIXES:

- 修复KRDS创建失败后,临时参数组没有清理的问题

## 1.3.61 (Dec 27, 2022)

BUG FIXES:

- 修复KRDS修改parameters,float类型参数不生效的问题
- 修复KRDS新建实例,parameters不生效,必须创建完成后再modify一次的问题
- 增加KRDS的force_restart参数说明

## 1.3.60 (Dec 15, 2022)

BUG FIXES:

- 修复EIP通过其他方式修改项目制后,无法从tf获取EIP数据的问题。


## 1.3.59 (Dec 2, 2022)

BUG FIXES:
Expand Down
5 changes: 4 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ dev: clean fmt
@bash ./scripts/devinit.sh $(version)

clean:
rm -rf bin/*
rm -rf bin/*

doc:
cd gendoc && go run ./... && cd ..
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ $ go test -test.run TestAccKsyunEip_basic -v

2、 到tf文件所在目录执行`terraform init --plugin-dir ~/.terraform.d/plugin-cache/`会获取到本地版本的provider(**注意**:高版本的terraform需要指定provider所在路径,这里通过参数形式指定,其他指定方式可以参考官方开发文档:https://www.terraform.io/cli/config/config-file)

生成文档

make doc

##### terraform-provider-ksyun使用

Expand Down
2 changes: 1 addition & 1 deletion example/instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "ksyun_instance" "default" {
project_id = 0
// data_guard_id=""
// force_delete =true
// user_data=""
user_data="IyEvYmluL2Jhc2gKCmVjaG8gIjEyMyIKClRGX0xPRz1kZWJ1ZyB0ZXJyYWZvcm0gaW1wb3J0IGtzeXVuX3RhZy5pbXBvcnRfZXhhbXBsZSAyMjI6cnJlcix2cGM6N2ZmNTcyMjItMjdkZi00MmY0LTg5Y2QtODI0ODZhZjQwZTZk"
// iam_role_name = "KsyunKECImageImportDefaultRole"
force_reinstall_system = false
instance_status = "active"
Expand Down
4 changes: 4 additions & 0 deletions example/rds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ resource "ksyun_krds" "houbin_terraform_4"{
value = "ROW"
}

# 部分parameters的更新,需要重启才能生效
# 将force_restart设置为true,会在修改参数后自动执行重启
# force_restart = true

}


Expand Down
3 changes: 3 additions & 0 deletions gendoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func genDoc(product, dtype, fpath, name string, resource *schema.Resource) {
}

pos := strings.Index(description, "\nExample Usage\n")
if pos == -1 {
pos = strings.Index(description, "\n# Example Usage\n")
}
if pos != -1 {
data["example"] = formatHCL(description[pos+15:])
description = strings.TrimSpace(description[:pos])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This data source provides a list of available zones in the current region.
data "ksyun_availability_zones" "default" {
output_file=""
ids=[]
}
```
Expand All @@ -23,24 +22,27 @@ func dataSourceKsyunAvailabilityZones() *schema.Resource {
Read: dataSourceKsyunAvailabilityZonesRead,
Schema: map[string]*schema.Schema{
"output_file": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "File name where to save data source results (after running `terraform plan`).",
},

"total_count": {
Type: schema.TypeInt,
Computed: true,
Type: schema.TypeInt,
Computed: true,
Description: "Total number of AvailabilityZones that satisfy the condition.",
},

"availability_zones": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
Description: "An information list of AvailabilityZone. Each element contains the following attributes:",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"availability_zone_name": {
Type: schema.TypeString,
Computed: true,
Description: "Name of the zone",
Description: "Name of the zone.",
},
},
},
Expand Down
63 changes: 44 additions & 19 deletions ksyun/data_source_ksyun_vpcs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
This data source provides a list of VPC resources according to their VPC ID, name.
# Example Usage
```hcl
data "ksyun_vpcs" "default" {
output_file="output_result"
ids=[]
}
```
*/
package ksyun

import (
Expand All @@ -16,57 +30,68 @@ func dataSourceKsyunVpcs() *schema.Resource {
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
Set: schema.HashString,
Description: "A list of VPC IDs, all the VPC resources belong to this region will be retrieved if the ID is `\"\"`.",
},

"name_regex": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsValidRegExp,
Description: "A regex string to filter results by VPC name.",
},

"output_file": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "File name where to save data source results (after running `terraform plan`).",
},

"total_count": {
Type: schema.TypeInt,
Computed: true,
Type: schema.TypeInt,
Computed: true,
Description: "Total number of VPC resources that satisfy the condition.",
},
"vpcs": {
Type: schema.TypeList,
Computed: true,
Type: schema.TypeList,
Computed: true,
Description: "It is a nested type which documented below.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The ID of VPC.",
},

"vpc_id": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The ID of VPC.",
},

"name": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The name of VPC.",
},

"vpc_name": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The name of VPC.",
},

"cidr_block": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The CIDR blocks of VPC.",
},

"create_time": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: "The time of creation for VPC, formatted in RFC3339 time string.",
},
},
},
Expand Down
48 changes: 32 additions & 16 deletions ksyun/provider.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
/*
*
The Ksyun provider is used to interact with many resources supported by Ksyun.
The provider needs to be configured with the proper credentials before it can be used.
Expand All @@ -10,34 +11,49 @@ with the proper credentials before it can be used.
Use the navigation to the left to read about the available resources.
Example Usage
# Example Usage
```hcl
terraform {
required_providers {
ksyun = {
source = "kingsoftcloud/ksyun"
}
}
}
# Configure the TencentCloud Provider
provider "ksyun" {
access_key = "your ak"
secret_key = "your sk"
region = "cn-beijing-6"
}
terraform {
required_providers {
ksyun = {
source = "kingsoftcloud/ksyun"
}
}
}
# Configure the ksyun Provider
provider "ksyun" {
access_key = "your ak"
secret_key = "your sk"
region = "cn-beijing-6"
}
```
Resources List
# Resources List
Provider Data Sources
ksyun_availability_zones
EIP
Data Source
ksyun_eips
Resource
ksyun_eip
VPC
Data Source
ksyun_vpcs
Resource
ksyun_vpc
*/
package ksyun

Expand Down
Loading

0 comments on commit 5511019

Please sign in to comment.