-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from volcengine/Feat/private-zone
Feat/private zone
- Loading branch information
Showing
47 changed files
with
4,363 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_private_zone_record_sets" "foo" { | ||
zid = 245**** | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "volcengine_private_zone_records" "foo" { | ||
zid = 245**** | ||
record_id = "907925684878276****" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data "volcengine_private_zone_resolver_endpoints" "foo" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data "volcengine_private_zone_resolver_rules" "foo" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
data "volcengine_private_zones" "foo" { | ||
zid = 77**** | ||
zone_name = "volces.com" | ||
search_mode = "EXACT" | ||
recursion_mode = true | ||
line_mode = 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "volcengine_private_zone" "foo" { | ||
zone_name = "acc-test-pz.com" | ||
remark = "acc-test-new" | ||
recursion_mode = true | ||
intelligent_mode = true | ||
load_balance_mode = true | ||
vpcs { | ||
vpc_id = "vpc-rs4mi0jedipsv0x57pf****" | ||
} | ||
vpcs { | ||
vpc_id = "vpc-3qdzk9xju6o747prml0jk****" | ||
region = "cn-shanghai" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
resource "volcengine_private_zone_record" "foo" { | ||
zid = 245**** | ||
host = "www" | ||
type = "A" | ||
value = "10.1.1.158" | ||
weight = 8 | ||
ttl = 700 | ||
remark = "tf-test" | ||
enable = true | ||
} | ||
|
||
data "volcengine_private_zone_record_sets" "foo" { | ||
zid = volcengine_private_zone_record.foo.zid | ||
host = volcengine_private_zone_record.foo.host | ||
search_mode = "EXACT" | ||
} | ||
|
||
resource "volcengine_private_zone_record_weight_enabler" "foo" { | ||
zid = volcengine_private_zone_record.foo.zid | ||
record_set_id = [for set in data.volcengine_private_zone_record_sets.foo.record_sets : set.record_set_id if set.type == volcengine_private_zone_record.foo.type][0] | ||
weight_enabled = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
resource "volcengine_private_zone_record" "foo" { | ||
zid = 245**** | ||
host = "www" | ||
type = "A" | ||
value = "10.1.1.158" | ||
weight = 8 | ||
ttl = 700 | ||
remark = "tf-test" | ||
enable = true | ||
} | ||
|
||
data "volcengine_private_zone_record_sets" "foo" { | ||
zid = volcengine_private_zone_record.foo.zid | ||
host = volcengine_private_zone_record.foo.host | ||
search_mode = "EXACT" | ||
} | ||
|
||
resource "volcengine_private_zone_record_weight_enabler" "foo" { | ||
zid = volcengine_private_zone_record.foo.zid | ||
record_set_id = [for set in data.volcengine_private_zone_record_sets.foo.record_sets : set.record_set_id if set.type == volcengine_private_zone_record.foo.type][0] | ||
weight_enabled = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
resource "volcengine_private_zone_resolver_endpoint" "foo" { | ||
name = "tf-test" | ||
vpc_id = "vpc-13f9uuuqfdjb43n6nu5p1****" | ||
vpc_region = "cn-beijing" | ||
security_group_id = "sg-mj2nsckay29s5smt1b0d****" | ||
ip_configs { | ||
az_id = "cn-beijing-a" | ||
subnet_id = "subnet-mj2o4co2m2v45smt1bx1****" | ||
ip = "172.16.0.2" | ||
} | ||
ip_configs { | ||
az_id = "cn-beijing-a" | ||
subnet_id = "subnet-mj2o4co2m2v45smt1bx1****" | ||
ip = "172.16.0.3" | ||
} | ||
ip_configs { | ||
az_id = "cn-beijing-a" | ||
subnet_id = "subnet-mj2o4co2m2v45smt1bx1****" | ||
ip = "172.16.0.4" | ||
} | ||
ip_configs { | ||
az_id = "cn-beijing-a" | ||
subnet_id = "subnet-mj2o4co2m2v45smt1bx1****" | ||
ip = "172.16.0.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "volcengine_private_zone_resolver_rule" "foo" { | ||
endpoint_id = 346 | ||
name = "tf0" | ||
type = "OUTBOUND" | ||
vpcs { | ||
region = "cn-beijing" | ||
vpc_id = "vpc-13f9uuuqfdjb43n6nu5p1****" | ||
} | ||
forward_ips { | ||
ip = "10.199.38.19" | ||
port = 33 | ||
} | ||
zone_name = ["www.baidu.com"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "volcengine_private_zone_user_vpc_authorization" "foo" { | ||
account_id = "2100278462" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
volcengine/private_zone/private_zone/data_source_volcengine_private_zones.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
package private_zone | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation" | ||
ve "github.com/volcengine/terraform-provider-volcengine/common" | ||
) | ||
|
||
func DataSourceVolcenginePrivateZones() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceVolcenginePrivateZonesRead, | ||
Schema: map[string]*schema.Schema{ | ||
"zid": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Description: "The zid of Private Zone.", | ||
}, | ||
"zone_name": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The name of Private Zone.", | ||
}, | ||
"region": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The region of Private Zone.", | ||
}, | ||
"vpc_id": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The vpc id associated to Private Zone.", | ||
}, | ||
"recursion_mode": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Whether the recursion mode of Private Zone is enabled.", | ||
}, | ||
"line_mode": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Description: "The line mode of Private Zone, specified whether the intelligent mode and the load balance function is enabled.", | ||
}, | ||
"search_mode": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "LIKE", | ||
ValidateFunc: validation.StringInSlice([]string{"LIKE", "EXACT"}, false), | ||
Description: "The search mode of query. Valid values: `LIKE`, `EXACT`. Default is `LIKE`.", | ||
}, | ||
|
||
"name_regex": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: validation.StringIsValidRegExp, | ||
Description: "A Name Regex of Resource.", | ||
}, | ||
"output_file": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "File name where to save data source results.", | ||
}, | ||
"total_count": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "The total count of query.", | ||
}, | ||
"private_zones": { | ||
Description: "The collection of query.", | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The id of the private zone.", | ||
}, | ||
"zid": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "The id of the private zone.", | ||
}, | ||
"zone_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The id of the private zone.", | ||
}, | ||
"remark": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The remark of the private zone.", | ||
}, | ||
"record_count": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "The record count of the private zone.", | ||
}, | ||
"recursion_mode": { | ||
Type: schema.TypeBool, | ||
Computed: true, | ||
Description: "Whether the recursion mode of the private zone is enabled.", | ||
}, | ||
"line_mode": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "The line mode of the private zone, specified whether the intelligent mode and the load balance function is enabled.", | ||
}, | ||
"last_operator": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The account id of the last operator who created the private zone.", | ||
}, | ||
"created_at": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The created time of the private zone.", | ||
}, | ||
"updated_at": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The updated time of the private zone.", | ||
}, | ||
"region": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
Description: "The region of the private zone.", | ||
}, | ||
"bind_vpcs": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "The Bind vpc info of the private zone.", | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The id of the bind vpc.", | ||
}, | ||
"region": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The region of the bind vpc.", | ||
}, | ||
"region_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The region name of the bind vpc.", | ||
}, | ||
"account_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The account id of the bind vpc.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceVolcenginePrivateZonesRead(d *schema.ResourceData, meta interface{}) error { | ||
service := NewPrivateZoneService(meta.(*ve.SdkClient)) | ||
return service.Dispatcher.Data(service, d, DataSourceVolcenginePrivateZones()) | ||
} |
Oops, something went wrong.