-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource/alicloud_vpc: Adds new attribute classic_link_enabled, create_time, ipv6_cidr_blocks, ipv6_isp; resource/alicloud_vswitch: Adds new attributes create_time, resource_group_id, route_table_id. #6119
Conversation
a0b0ef4
to
0f5e242
Compare
448936d
to
800ea00
Compare
|
||
-> **NOTE:** Terraform will auto build a router and a route table while it uses `alicloud_vpc` to build a vpc resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个信息不能丢失,已经维护到Spec上的资源英文描述中
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,已经维护到spec上
CheckDestroy: rac.checkResourceDestroy(), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccConfig(map[string]interface{}{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当存在资源名称的属性时,应该作为测试第一步属性值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
website/docs/r/vpc_vpc.html.markdown
Outdated
* `ipv6_cidr_blocks` - The IPv6 CIDR block information of the VPC. | ||
* `ipv6_cidr_block` - The IPv6 CIDR block of the VPC. | ||
* `ipv6_isp` - Valid values: **BGP** (default): Alibaba Cloud BGP IPv6. | ||
-*ChinaMobile**: China Mobile (single line). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要多两格缩进
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
request["Ipv6CidrBlock"] = d.Get("ipv6_cidr_block") | ||
} | ||
|
||
if v, ok := d.GetOkExists("enable_ipv6"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
操作私有属性,不用判定HasChange,设置有值的时候随着api的调用传入即可
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
5b0c77f
to
42b8366
Compare
alicloud/resource_alicloud_vpc.go
Outdated
}, | ||
"dry_run": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
ForceNew: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dry_run 不应该是ForceNew的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"resource_group_id": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
资源组需要支持更新
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已确认VSwitch暂时不支持资源组,去除定义
website/docs/r/vpc.html.markdown
Outdated
|
||
For information about Vpc Vpc and how to use it, see [What is Vpc](https://www.alibabacloud.com/help/en/virtual-private-cloud/latest/what-is-a-vpc). | ||
|
||
-> **NOTE:** Available in v1.206.0+. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个信息不正确,去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
website/docs/r/vpc.html.markdown
Outdated
- **ChinaUnicom**: China Unicom (single line). | ||
- **ChinaTelecom**: China Telecom (single line). | ||
> If a single-line bandwidth whitelist is enabled, this field can be set to **ChinaTelecom** (China Telecom), **ChinaUnicom** (China Unicom), or **ChinaMobile** (China Mobile). | ||
* `resource_group_id` - (Optional, Computed) The ID of the resource group to which the VPC belongs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
资源组的可用版本信息
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
``` | ||
|
||
## Module Support | ||
|
||
You can use to the existing [vpc module](https://registry.terraform.io/modules/alibaba/vpc/alicloud) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个信息还是要维护起来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `availability_zone` - (Optional, ForceNew, Deprecated from v1.119.0+) Field `availability_zone` has been deprecated from provider version 1.119.0. New field `zone_id` instead. | ||
* `zone_id` - (Optional, ForceNew, Available in 1.119.0+) The AZ for the switch. **Note:** Required for a VPC switch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看下生成器为什么丢失了zone_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
website/docs/r/vswitch.html.markdown
Outdated
- **true**: enables IPv6. | ||
- **false** (default): IPv6 is not enabled. | ||
* `ipv6_cidr_block_mask` - (Optional) The IPv6 CIDR block of the VSwitch. | ||
* `tags` - (Optional, Map) The tags of VSwitch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tags、vswitch_name、enable_ipv6、ipv6_cidr_block_mask 的版本信息丢失了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
website/docs/r/vswitch.html.markdown
Outdated
|
||
## Example Usage | ||
|
||
Basic Usage | ||
|
||
```terraform | ||
resource "alicloud_vpc" "vpc" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里以前的示例更加丰富,需要考虑生成器如何生成指定的多个测试用例,目前仅生成一个。这里先将以前的用例补充回来。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
42b8366
to
1ad90da
Compare
ValidateFunc: validateCIDRNetworkAddress, | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个默认值应该去不掉,你试试通过API的方式,不传这个参数会有问题么
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
试了可以,系统默认值就是 172.16.0.0/12
alicloud/resource_alicloud_vpc.go
Outdated
ForceNew: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
"vswitch_ids": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个vswitch_ids没必要透出
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,后续滤除除status和create_time之外其它的所有只读属性,除存量已经透出的字段,后续新增的只读属性在Resource上不再透出
"route_table_id": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
route_table_id这个属性没有在 CUD 中出现啊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
route_table_id是标准的属性名,同以前的router_table_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个属性是需要保留的
alicloud/resource_alicloud_vpc.go
Outdated
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
"vpc_id": { | ||
Type: schema.TypeString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经有 id 了,不需要 vpc_id 了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Check: resource.ComposeTestCheckFunc( | ||
testAccCheck(map[string]string{ | ||
"cidr_block": "172.16.0.0/12", | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥 cidr_block, vpc_name, description 反复修改了很多次
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
生成逻辑的缺陷,目前资源测试用例录入n步后,生成的Terraform测试步骤会处理为:
- 资源用例第1步中如果存在必填值,则将用例中第1步只取必填保留,剩下的其它非必填的m个可改属性,会拆分为m步;
- 资源用例第2到n步中的所有可改属性,按单个属性更新的方式拆分为 (n-1)*m 步。
所有录入的时候,第一步全填值并且存在较多的可改属性,第二、三步中的可改属性重复,那么生成的时候就反复修改。
这里可以进一步优化一下生成逻辑。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
"status": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"tags": tagsSchema(), | ||
"vswitch_id": { | ||
Type: schema.TypeString, | ||
Computed: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也一样
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ResourceName: resourceId, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"enable_ipv6", "ipv6_cidr_block_mask"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ipv6_cidr_block_mask 不应该被 ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ipv6_cidr_block_mask 实际在spec上的定义就是一个操作私有属性,目前Spec上一个出参仅能对应一个属性,api上的这个对应参数映射到了另一个属性(Ipv6Block)上了。所以这个属性是个操作私有属性,因此生成的时候这里被ignore了。
这里考虑对spec进行扩展,支持在资源属性上直接定义JSONNata,这样就可以当成普通属性正常取值。
1ad90da
to
ac6fa25
Compare
}) | ||
} | ||
|
||
var AlicloudVpcVpcMap3113 = map[string]string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed 的check set 下吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…e_time, dhcp_options_set_id, ipv6_cidr_blocks, ipv6_isp, vswitch_ids, vpc_id; resource/alicloud_vswitch: Adds new attributes create_time, network_acl_id, route_table_id, vswitch_id.
ac6fa25
to
3a4e9ee
Compare
No description provided.