Skip to content
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

[WAFD] res_tenant fix in resource/opentelekomcloud_waf_dedicated_instance_v1 #2497

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/resources/waf_dedicated_instance_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ The following arguments are supported:
* `architecture` - (Optional, String, ForceNew) Dedicated engine CPU architecture. Default value is `x86`.
Changing this will create a new instance.

* `res_tenant` - (Optional, String, ForceNew) Whether the dedicated WAF instance is network interface type.
Default value is `true`. Changing this will create a new instance.

## Attributes Reference

The following attributes are exported:
Expand Down Expand Up @@ -117,4 +120,10 @@ WAF dedicated instance can be imported using the `id`, e.g.

```bash
$ terraform import opentelekomcloud_waf_dedicated_instance_v1.wafd <id>
lifecycle {
ignore_changes = [
res_tenant,
specification,
]
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestAccWafDedicatedInstanceV1_basic(t *testing.T) {
ResourceName: wafdInstanceResourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"specification"},
ImportStateVerifyIgnore: []string{"specification", "res_tenant"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func ResourceWafDedicatedInstance() *schema.Resource {
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"res_tenant": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: true,
},
"server_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -142,7 +148,7 @@ func resourceWafDedicatedInstanceV1Create(ctx context.Context, d *schema.Resourc
SubnetId: d.Get("subnet_id").(string),
SecurityGroupsId: groups,
Count: defaultCount,
ResTenant: pointerto.Bool(true),
ResTenant: pointerto.Bool(d.Get("res_tenant").(bool)),
}

r, err := instances.Create(client, opts)
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/wafd-res-tenant-attr-ed14456250891133.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
|
**[WAF]** Fix setting `res_tenant` attribute in ``resource/opentelekomcloud_waf_dedicated_instance_v1`` (`#2497 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2497>`_)