diff --git a/.changelog/2622.txt b/.changelog/2622.txt new file mode 100644 index 0000000000..946fb917d1 --- /dev/null +++ b/.changelog/2622.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_clb_attachment: optimization documentation +``` \ No newline at end of file diff --git a/tencentcloud/services/clb/resource_tc_clb_attachment.md b/tencentcloud/services/clb/resource_tc_clb_attachment.md index 1de35f8bfc..c91e27f799 100644 --- a/tencentcloud/services/clb/resource_tc_clb_attachment.md +++ b/tencentcloud/services/clb/resource_tc_clb_attachment.md @@ -1,7 +1,26 @@ Provides a resource to create a CLB attachment. +~> **NOTE:** This resource is designed to manage the entire set of binding relationships associated with a particular CLB (Cloud Load Balancer). As such, it does not allow the simultaneous use of this resource for the same CLB across different contexts or environments. + + Example Usage +Bind a Cvm instance +```hcl +resource "tencentcloud_clb_attachment" "foo" { + clb_id = "lb-k2zjp9lv" + listener_id = "lbl-hh141sn9" + rule_id = "loc-4xxr2cy7" + + targets { + instance_id = "ins-1flbqyp8" + port = 80 + weight = 10 + } +} +``` + +Bind multiple Cvm instances ```hcl resource "tencentcloud_clb_attachment" "foo" { clb_id = "lb-k2zjp9lv" @@ -13,9 +32,29 @@ resource "tencentcloud_clb_attachment" "foo" { port = 80 weight = 10 } + + targets { + instance_id = "ins-ekloqpa1" + port = 81 + weight = 10 + } } ``` +Bind backend target is ENI +```hcl +resource "tencentcloud_clb_attachment" "foo" { + clb_id = "lb-k2zjp9lv" + listener_id = "lbl-hh141sn9" + rule_id = "loc-4xxr2cy7" + + targets { + eni_ip = "example-ip" + port = 23 + weight = 50 + } +} +``` Import CLB attachment can be imported using the id, e.g. diff --git a/website/docs/r/clb_attachment.html.markdown b/website/docs/r/clb_attachment.html.markdown index 055d8b2bb0..b8eaf50e22 100644 --- a/website/docs/r/clb_attachment.html.markdown +++ b/website/docs/r/clb_attachment.html.markdown @@ -11,8 +11,28 @@ description: |- Provides a resource to create a CLB attachment. +~> **NOTE:** This resource is designed to manage the entire set of binding relationships associated with a particular CLB (Cloud Load Balancer). As such, it does not allow the simultaneous use of this resource for the same CLB across different contexts or environments. + ## Example Usage +### Bind a Cvm instance + +```hcl +resource "tencentcloud_clb_attachment" "foo" { + clb_id = "lb-k2zjp9lv" + listener_id = "lbl-hh141sn9" + rule_id = "loc-4xxr2cy7" + + targets { + instance_id = "ins-1flbqyp8" + port = 80 + weight = 10 + } +} +``` + +### Bind multiple Cvm instances + ```hcl resource "tencentcloud_clb_attachment" "foo" { clb_id = "lb-k2zjp9lv" @@ -24,6 +44,28 @@ resource "tencentcloud_clb_attachment" "foo" { port = 80 weight = 10 } + + targets { + instance_id = "ins-ekloqpa1" + port = 81 + weight = 10 + } +} +``` + +### Bind backend target is ENI + +```hcl +resource "tencentcloud_clb_attachment" "foo" { + clb_id = "lb-k2zjp9lv" + listener_id = "lbl-hh141sn9" + rule_id = "loc-4xxr2cy7" + + targets { + eni_ip = "example-ip" + port = 23 + weight = 50 + } } ```