Skip to content
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
2 changes: 2 additions & 0 deletions tencentcloud/resource_tc_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func resourceTencentCloudEip() *schema.Resource {
"internet_charge_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validateAllowedStringValue(CVM_INTERNET_CHARGE_TYPE),
Description: "The charge type of eip. Valid value: `BANDWIDTH_PACKAGE`, `BANDWIDTH_POSTPAID_BY_HOUR` and `TRAFFIC_POSTPAID_BY_HOUR`.",
Expand Down Expand Up @@ -241,6 +242,7 @@ func resourceTencentCloudEipRead(d *schema.ResourceData, meta interface{}) error
_ = d.Set("type", eip.AddressType)
_ = d.Set("public_ip", eip.AddressIp)
_ = d.Set("status", eip.AddressStatus)
_ = d.Set("internet_charge_type", eip.InternetChargeType)
_ = d.Set("tags", tags)
return nil
}
Expand Down
30 changes: 30 additions & 0 deletions tencentcloud/resource_tc_eip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,29 @@ func TestAccTencentCloudEip_bandwidth(t *testing.T) {
})
}

func TestAccTencentCloudEip_chargetype(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckEipDestroy,
Steps: []resource.TestStep{
{
Config: testAccEipChargeType,
Check: resource.ComposeTestCheckFunc(
testAccCheckEipExists("tencentcloud_eip.foo"),
resource.TestCheckResourceAttr("tencentcloud_eip.foo", "internet_charge_type", "TRAFFIC_POSTPAID_BY_HOUR"),
),
},
{
ResourceName: "tencentcloud_eip.foo",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCheckEipExists(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
logId := getLogId(contextNil)
Expand Down Expand Up @@ -312,3 +335,10 @@ resource "tencentcloud_eip" "foo" {
internet_max_bandwidth_out = 2
}
`

const testAccEipChargeType = `
resource "tencentcloud_eip" "foo" {
name = "eip_charge_type"
internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
}
`