Skip to content

Commit

Permalink
resource/pvtz_rule: add the query field bind_vpcs resource/alb_load_b…
Browse files Browse the repository at this point in the history
…alancer: add the query field dns_name
  • Loading branch information
Wanghx0991 committed Feb 25, 2022
1 parent c591fe7 commit 0348dc3
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 14 deletions.
39 changes: 39 additions & 0 deletions alicloud/data_source_alicloud_pvtz_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ func dataSourceAlicloudPvtzRules() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"bind_vpcs": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"vpc_name": {
Type: schema.TypeString,
Computed: true,
},
"vpc_id": {
Type: schema.TypeString,
Computed: true,
},
"region_name": {
Type: schema.TypeString,
Computed: true,
},
"region_id": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
},
},
},
Expand All @@ -116,6 +140,7 @@ func dataSourceAlicloudPvtzRulesRead(d *schema.ResourceData, meta interface{}) e
request["Lang"] = "en"
request["PageSize"] = PageSizeLarge
request["PageNumber"] = 1
request["NeedDetailAttributes"] = true
var objects []map[string]interface{}
var ruleNameRegex *regexp.Regexp
if v, ok := d.GetOk("name_regex"); ok {
Expand Down Expand Up @@ -206,6 +231,20 @@ func dataSourceAlicloudPvtzRulesRead(d *schema.ResourceData, meta interface{}) e
}
}
mapping["forward_ips"] = forwardConfigsSli

bindVpcsSlice := make([]map[string]interface{}, 0)
if bindVpcs, ok := object["BindVpcs"].([]interface{}); ok {
for _, bindVpcsArgs := range bindVpcs {
bindVpcsArg := bindVpcsArgs.(map[string]interface{})
bindVpcsMap := make(map[string]interface{})
bindVpcsMap["vpc_id"] = bindVpcsArg["VpcId"]
bindVpcsMap["region_id"] = bindVpcsArg["RegionId"]
bindVpcsMap["vpc_name"] = bindVpcsArg["VpcName"]
bindVpcsMap["region_name"] = bindVpcsArg["RegionName"]
bindVpcsSlice = append(bindVpcsSlice, bindVpcsMap)
}
}
mapping["bind_vpcs"] = bindVpcsSlice
ids = append(ids, fmt.Sprint(mapping["id"]))
names = append(names, object["Name"])
s = append(s, mapping)
Expand Down
5 changes: 5 additions & 0 deletions alicloud/resource_alicloud_alb_load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ func resourceAlicloudAlbLoadBalancer() *schema.Resource {
},
ForceNew: true,
},
"dns_name": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -289,6 +293,7 @@ func resourceAlicloudAlbLoadBalancerRead(d *schema.ResourceData, meta interface{
d.Set("zone_mappings", zoneMappingsMaps)
}

d.Set("dns_name", object["DNSName"])
return nil
}
func resourceAlicloudAlbLoadBalancerUpdate(d *schema.ResourceData, meta interface{}) error {
Expand Down
1 change: 1 addition & 0 deletions alicloud/resource_alicloud_alb_load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func TestAccAlicloudALBLoadBalancer_basic0(t *testing.T) {
"load_balancer_edition": "Basic",
"load_balancer_billing_config.#": "1",
"zone_mappings.#": "2",
"dns_name": CHECKSET,
}),
),
},
Expand Down
2 changes: 1 addition & 1 deletion alicloud/resource_alicloud_oos_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func OosTemplateBasicdependence(name string) string {
return ""
}

func TestAccAlicloudOOSStateConfiguration_unit(t *testing.T) {
func TestAccAlicloudOosTemplate_unit(t *testing.T) {
p := Provider().(*schema.Provider).ResourcesMap
d, _ := schema.InternalMap(p["alicloud_oos_template"].Schema).Data(nil, nil)
dCreate, _ := schema.InternalMap(p["alicloud_oos_template"].Schema).Data(nil, nil)
Expand Down
26 changes: 18 additions & 8 deletions website/docs/d/pvtz_rules.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ The following attributes are exported in addition to the arguments listed above:

* `names` - A list of Rule names.
* `rules` - A list of PrivateZone Rules. Each element contains the following attributes:
* `create_time` - The creation time of the resource.
* `endpoint_id` - The ID of the Endpoint.
* `endpoint_name` - The Name of the Endpoint.
* `id` - The ID of the Rule.
* `rule_id` - The first ID of the resource.
* `rule_name` - The name of the resource.
* `type` - The type of the rule.
* `zone_name` - The name of the forwarding zone.
* `create_time` - The creation time of the resource.
* `endpoint_id` - The ID of the Endpoint.
* `endpoint_name` - The Name of the Endpoint.
* `id` - The ID of the Rule.
* `rule_id` - The first ID of the resource.
* `rule_name` - The name of the resource.
* `type` - The type of the rule.
* `zone_name` - The name of the forwarding zone.
* `bind_vpcs` - The List of the VPC. See the following `Block bind_vpcs`. **NOTE:** Available in v1.158.0+.

#### Block bind_vpcs

The bind_vpcs supports the following:

* `vpc_id` - The ID of the VPC.
* `region_id` - The region ID of the vpc.
* `vpc_name` - The Name of the VPC.
* `region_name` - The Region Name of the vpc.
4 changes: 3 additions & 1 deletion website/docs/r/alb_load_balancer.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ resource "alicloud_alb_load_balancer" "default" {
```

## Argument Reference
R

The following arguments are supported:

* `access_log_config` - (Optional, Optional) The Access Logging Configuration Structure.
Expand All @@ -100,6 +100,7 @@ The following arguments are supported:
* `resource_group_id` - (Optional) The ID of the resource group.
* `vpc_id` - (Required, ForceNew) The ID of the virtual private cloud (VPC) where the ALB instance is deployed.
* `zone_mappings` - (Required, ForceNew) The zones and vSwitches. You must specify at least two zones.
* `tags` - (Optional) A mapping of tags to assign to the resource.

#### Block load_balancer_billing_config

Expand Down Expand Up @@ -136,6 +137,7 @@ The following attributes are exported:

* `id` - The resource ID in terraform of Load Balancer.
* `status` - The load balancer status. Valid values: `Active`, `Configuring`, `CreateFailed`
* `dns_name` - The domain name of the ALB instance. **NOTE:** Available in v1.158.0+.

### Timeouts

Expand Down
3 changes: 1 addition & 2 deletions website/docs/r/fc_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ resource "alicloud_fc_service" "foo" {

## Module Support

You can use to the existing [fc module](https://registry.terraform.io/modules/terraform-alicloud-modules/fc/alicloud)
to create a service and a function quickly and then set several triggers for it.
You can use to the existing [fc module](https://registry.terraform.io/modules/terraform-alicloud-modules/fc/alicloud) to create a service and a function quickly and then set several triggers for it.

## Argument Reference

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/oss_bucket_object.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ resource "alicloud_oss_bucket_object" "object-content" {

The following arguments are supported:

* `bucket` - (Required) The name of the bucket to put the file in.
* `key` - (Required) The name of the object once it is in the bucket.
* `bucket` - (Required, ForceNew) The name of the bucket to put the file in.
* `key` - (Required, ForceNew) The name of the object once it is in the bucket.
* `source` - (Optional) The path to the source file being uploaded to the bucket.
* `content` - (Optional unless `source` given) The literal content being uploaded to the bucket.
* `acl` - (Optional) The [canned ACL](https://www.alibabacloud.com/help/doc-detail/52284.htm) to apply. Defaults to "private".
Expand Down

0 comments on commit 0348dc3

Please sign in to comment.