Skip to content

Commit a248703

Browse files
authored
Merge pull request #175 from volcengine/Feat/pg-allowlist
Feat/pg allowlist
2 parents 505f7eb + f3d99f9 commit a248703

28 files changed

+1248
-26
lines changed

common/common_volcengine_limit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func init() {
4343
Limiter: rate.NewLimiter(4, 10),
4444
Semaphore: semaphore.NewWeighted(10),
4545
},
46+
"storage_ebs.DescribeVolumes.2020-04-01": {
47+
Limiter: rate.NewLimiter(10, 30),
48+
Semaphore: semaphore.NewWeighted(30),
49+
},
4650
}
4751
}
4852

common/common_volcengine_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package common
22

33
const (
44
TerraformProviderName = "terraform-provider-volcengine"
5-
TerraformProviderVersion = "0.0.151"
5+
TerraformProviderVersion = "0.0.152"
66
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "volcengine_rds_postgresql_allowlists" "foo" {
2+
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource "volcengine_rds_postgresql_allowlist" "foo" {
2+
allow_list_name = "acc-test-allowlist"
3+
allow_list_desc = "acc-test"
4+
allow_list_type = "IPv4"
5+
allow_list = ["192.168.0.0/24", "192.168.1.0/24"]
6+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
data "volcengine_zones" "foo" {
2+
}
3+
4+
resource "volcengine_vpc" "foo" {
5+
vpc_name = "acc-test-vpc"
6+
cidr_block = "172.16.0.0/16"
7+
}
8+
9+
resource "volcengine_subnet" "foo" {
10+
subnet_name = "acc-test-subnet"
11+
cidr_block = "172.16.0.0/24"
12+
zone_id = data.volcengine_zones.foo.zones[0].id
13+
vpc_id = volcengine_vpc.foo.id
14+
}
15+
16+
17+
resource "volcengine_rds_postgresql_instance" "foo" {
18+
db_engine_version = "PostgreSQL_12"
19+
node_spec = "rds.postgres.1c2g"
20+
primary_zone_id = data.volcengine_zones.foo.zones[0].id
21+
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
22+
storage_space = 40
23+
subnet_id = volcengine_subnet.foo.id
24+
instance_name = "acc-test-postgresql"
25+
charge_info {
26+
charge_type = "PostPaid"
27+
}
28+
project_name = "default"
29+
tags {
30+
key = "tfk1"
31+
value = "tfv1"
32+
}
33+
parameters {
34+
name = "auto_explain.log_analyze"
35+
value = "off"
36+
}
37+
parameters {
38+
name = "auto_explain.log_format"
39+
value = "text"
40+
}
41+
}
42+
43+
resource "volcengine_rds_postgresql_allowlist" "foo" {
44+
allow_list_name = "acc-test-allowlist"
45+
allow_list_desc = "acc-test"
46+
allow_list_type = "IPv4"
47+
allow_list = ["192.168.0.0/24", "192.168.1.0/24"]
48+
}
49+
50+
resource "volcengine_rds_postgresql_allowlist_associate" "foo" {
51+
instance_id = volcengine_rds_postgresql_instance.foo.id
52+
allow_list_id = volcengine_rds_postgresql_allowlist.foo.id
53+
}

volcengine/cen/cen_service_route_entry/resource_volcengine_cen_service_route_entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func ResourceVolcengineCenServiceRouteEntry() *schema.Resource {
7676
Description: "Publishing scope of cloud service access routes. Valid values are `LocalDCGW`(default), `Custom`.",
7777
},
7878
"publish_to_instances": {
79-
Type: schema.TypeList,
79+
Type: schema.TypeSet,
8080
Optional: true,
8181
MaxItems: 100,
8282
Description: "The publish instances. A maximum of 100 can be uploaded in one request. This field needs to be filled in when the `publish_mode` is `Custom`.",

volcengine/cen/cen_service_route_entry/resource_volcengine_cen_service_route_entry_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ func TestAccVolcengineCenServiceRouteEntryResource_Basic(t *testing.T) {
8080
resource.TestCheckResourceAttr(acc.ResourceId, "publish_mode", "Custom"),
8181
resource.TestCheckResourceAttr(acc.ResourceId, "service_region_id", "cn-beijing"),
8282
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.#", "2"),
83-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.0.instance_type", "VPC"),
84-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.0.instance_region_id", "cn-beijing"),
85-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.1.instance_type", "VPC"),
86-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.1.instance_region_id", "cn-beijing"),
83+
volcengine.TestCheckTypeSetElemNestedAttrs(acc.ResourceId, "publish_to_instances.*", map[string]string{
84+
"instance_type": "VPC",
85+
"instance_region_id": "cn-beijing",
86+
}),
8787
resource.TestCheckResourceAttrSet(acc.ResourceId, "cen_id"),
8888
resource.TestCheckResourceAttrSet(acc.ResourceId, "service_vpc_id"),
8989
),
@@ -158,10 +158,10 @@ func TestAccVolcengineCenServiceRouteEntryResource_Update(t *testing.T) {
158158
resource.TestCheckResourceAttr(acc.ResourceId, "publish_mode", "Custom"),
159159
resource.TestCheckResourceAttr(acc.ResourceId, "service_region_id", "cn-beijing"),
160160
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.#", "2"),
161-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.0.instance_type", "VPC"),
162-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.0.instance_region_id", "cn-beijing"),
163-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.1.instance_type", "VPC"),
164-
resource.TestCheckResourceAttr(acc.ResourceId, "publish_to_instances.1.instance_region_id", "cn-beijing"),
161+
volcengine.TestCheckTypeSetElemNestedAttrs(acc.ResourceId, "publish_to_instances.*", map[string]string{
162+
"instance_type": "VPC",
163+
"instance_region_id": "cn-beijing",
164+
}),
165165
resource.TestCheckResourceAttrSet(acc.ResourceId, "cen_id"),
166166
resource.TestCheckResourceAttrSet(acc.ResourceId, "service_vpc_id"),
167167
),

volcengine/cen/cen_service_route_entry/service_volcengine_cen_service_route_entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (s *VolcengineCenServiceRouteEntryService) ModifyResource(resourceData *sch
208208
},
209209
BeforeCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (bool, error) {
210210
mode := d.Get("publish_mode").(string)
211-
instances := d.Get("publish_to_instances").([]interface{})
211+
instances := d.Get("publish_to_instances").(*schema.Set).List()
212212
if mode == "Custom" && len(instances) == 0 {
213213
return false, fmt.Errorf("public_to_instances must exist when publish_mode is Custom")
214214
}

volcengine/ecs/ecs_instance/data_source_volcengine_ecs_instances.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ func DataSourceVolcengineEcsInstances() *schema.Resource {
5454
Optional: true,
5555
Description: "The charge type of ECS instance.",
5656
},
57+
"instance_name": {
58+
Type: schema.TypeString,
59+
Optional: true,
60+
Description: "The name of ECS instance. This field support fuzzy query.",
61+
},
5762
"name_regex": {
5863
Type: schema.TypeString,
5964
Optional: true,

volcengine/ecs/ecs_launch_template/resource_volcengine_ecs_launch_template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func ResourceVolcengineEcsLaunchTemplate() *schema.Resource {
8585
"suffix_index": {
8686
Type: schema.TypeInt,
8787
Optional: true,
88+
Computed: true,
8889
Description: "The index of the ordered suffix.",
8990
},
9091
"key_pair_name": {

0 commit comments

Comments
 (0)