-
Notifications
You must be signed in to change notification settings - Fork 136
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
feat/cfw #2149
Conversation
go.mod
Outdated
@@ -100,7 +100,10 @@ require ( | |||
gopkg.in/yaml.v2 v2.4.0 | |||
) | |||
|
|||
require github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.754 | |||
require ( |
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.
这里为啥要单独一个 require 呢
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.
这是go mod自动生成的 非人为
natInsId = v.(string) | ||
} | ||
|
||
if v, _ := d.GetOkExists("status"); v != nil { |
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.
好上面使用的 GetOk, 什么情况下使用 GetOkExists ,什么情况下使用 GetOk 呢
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.
一般包含0 false 这种参数 就需要用GetOkExists 正常字符串用GetOk
"ap-taipei-6": "中国台北六区", | ||
} | ||
|
||
var ZONE_MAP_CN2EN = 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.
ZONE目前是写死的是吧,后面如果扩Zone后,这里要更新吗
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映射,如果后续扩zone,这里需要更新
return err | ||
} | ||
|
||
ruleUuid := *response.Response.RuleUuids[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.
response.Response.RuleUuids可能为空吗
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.
只要err为nil RuleUuids就不为空
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCfwVpcPolicy, | ||
Check: resource.ComposeTestCheckFunc( |
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.
这里每个字段都check下?
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_firewall_switch.example", "id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_firewall_switch.example", "nat_ins_id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_firewall_switch.example", "subnet_id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_firewall_switch.example", "enable"), |
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.
check下属性的值?
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_address_template.example", "id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_address_template.example", "name"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_address_template.example", "detail"), |
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.
check下字段值
intrusionDefenseRule.EndTime = helper.String(v.(string)) | ||
} | ||
|
||
if v, ok := d.GetOk("comment"); 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吗
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
resource.TestCheckResourceAttrSet("tencentcloud_cfw_block_ignore_list.example", "direction"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_block_ignore_list.example", "comment"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_block_ignore_list.example", "start_time"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_block_ignore_list.example", "end_time"), |
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.
check下字段的值
{ | ||
Config: testAccCfwAddressTemplateUpdate, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_address_template.example", "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.
Check下字段值
Config: testAccCfwEdgeFirewallSwitchUpdate, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_firewall_switch.example", "id"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_firewall_switch.example", "public_ip"), |
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.
check下字段值
return err | ||
} | ||
|
||
ruleUuid := *response.Response.RuleUuid[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.
response.Response.RuleUuid可能为空吗
if v, ok := d.GetOk("description"); ok { | ||
modifyRuleItem.Description = helper.String(v.(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.
这里应该有些字段需要加haschange判断吧
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "source_type"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "target_content"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "target_type"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "protocol"), |
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.
字段值Check下
|
||
edgeIpSwitch.PublicIp = &publicIp | ||
|
||
if v, ok := d.GetOk("subnet_id"); 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.
这里需要判断hansChange?
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "protocol"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "rule_action"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "port"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_edge_policy.example", "direction"), |
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.
check字段值
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.
LGTM
go.mod
Outdated
require github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.759 | ||
>>>>>>> 980b4317f5abdb75718178af297400be12062e6e |
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.
这里有冲突了
tencentcloud/provider.go
Outdated
@@ -1685,8 +1685,31 @@ Waf | |||
tencentcloud_waf_saas_domain | |||
tencentcloud_waf_clb_instance | |||
tencentcloud_waf_saas_instance | |||
<<<<<<< HEAD |
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.
这里也有冲突
{ | ||
Config: testAccCfwNatInstance, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_instance.example", "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.
后面补下其它字段的check逻辑
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_policy.example", "target_content"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_policy.example", "target_type"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_policy.example", "protocol"), | ||
resource.TestCheckResourceAttrSet("tencentcloud_cfw_nat_policy.example", "rule_action"), |
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.
后面完善用例时增加字段check逻辑
Example Usage | ||
|
||
```hcl | ||
resource "tencentcloud_cfw_sync_asset" "example" {} |
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.
这个是一个Operation?
* feat/cfw * feat/cfw * feat/cfw * feat/cfw * feat/cfw * feat/cfw * feat/cfw
feat/cfw