-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support data source tencentcloud_mps_schedules (#2185)
* support data source tencentcloud_mps_schedules * add doc
- Loading branch information
Showing
8 changed files
with
5,218 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-data-source | ||
tencentcloud_mps_schedules | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package tencentcloud | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccTencentCloudMpsSchedulesDataSource_basic(t *testing.T) { | ||
t.Parallel() | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { | ||
testAccPreCheck(t) | ||
}, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccMpsSchedulesDataSource_none, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckTencentCloudDataSourceID("data.tencentcloud_mps_schedules.schedules"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.activities.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.create_time"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.update_time"), | ||
), | ||
}, | ||
{ | ||
Config: fmt.Sprintf(testAccMpsSchedulesDataSource_specific_one, defaultMpsScheduleId), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckTencentCloudDataSourceID("data.tencentcloud_mps_schedules.schedules"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_ids.#"), | ||
resource.TestCheckTypeSetElemAttr("data.tencentcloud_mps_schedules.schedules", "schedule_ids.*", fmt.Sprint(defaultMpsScheduleId)), | ||
resource.TestCheckResourceAttr("data.tencentcloud_mps_schedules.schedules", "trigger_type", "CosFileUpload"), | ||
resource.TestCheckResourceAttr("data.tencentcloud_mps_schedules.schedules", "status", "Disabled"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.#"), | ||
resource.TestCheckResourceAttr("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.schedule_id", fmt.Sprint(defaultMpsScheduleId)), | ||
resource.TestCheckResourceAttr("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.schedule_name", defaultMpsScheduleName), | ||
resource.TestCheckResourceAttr("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.status", "Disabled"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.trigger.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.activities.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.output_storage.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.output_dir"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.task_notify_config.#"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.create_time"), | ||
resource.TestCheckResourceAttrSet("data.tencentcloud_mps_schedules.schedules", "schedule_info_set.0.update_time"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
const testAccMpsSchedulesDataSource_none = ` | ||
data "tencentcloud_mps_schedules" "schedules" { | ||
} | ||
` | ||
|
||
const testAccMpsSchedulesDataSource_specific_one = ` | ||
data "tencentcloud_mps_schedules" "schedules" { | ||
schedule_ids = [%d] | ||
trigger_type = "CosFileUpload" | ||
status = "Disabled" | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.