diff --git a/.githooks/pre-commit-local b/.githooks/pre-commit-local new file mode 100755 index 0000000000..dca120dc69 --- /dev/null +++ b/.githooks/pre-commit-local @@ -0,0 +1,28 @@ +#!/bin/sh +REQUIRED_GO_VERSION="1.18" # use the .go-version later + +printf "==> Step 1: Gofmt Check...\n" +make fmt-faster +if [ $? -ne 0 ]; then + printf "COMMIT FAILED\n" + exit 1 +fi + +printf "==> Step 2: Generating docs...\n" +doc=$(make doc 2>&1) +if [ $? -ne 0 ]; then + echo "$doc" | tail -n 4 | head -n 2 + printf "COMMIT FAILED\n" + exit 1 +fi + +printf "==> Step 2: Generating docs...\n" +go_version=$(go version | awk '{print $3}') +if [ $go_version -ne $REQUIRED_GO_VERSION* ]; then + echo "Go version is not compatible. Expected $REQUIRED_GO_VERSION.x" + printf "COMMIT FAILED\n" + exit 1 +fi + +printf "COMMIT READY\n" +exit 0 diff --git a/examples/tencentcloud-sms/main.tf b/examples/tencentcloud-sms/main.tf new file mode 100644 index 0000000000..96e2baabf4 --- /dev/null +++ b/examples/tencentcloud-sms/main.tf @@ -0,0 +1,8 @@ +resource "tencentcloud_sms_sign" "example" { + sign_name = "tf_example_sms_sign" + sign_type = 1 # 1:APP, DocumentType can be chosen(0,1,2,3,4) + document_type = 4 # Screenshot of application background management (personally developed APP) + international = 0 # Mainland China SMS + sign_purpose = 0 # personal use + proof_image = "your_proof_image" +} diff --git a/examples/tencentcloud-sms/variables.tf b/examples/tencentcloud-sms/variables.tf new file mode 100644 index 0000000000..300ecfbb76 --- /dev/null +++ b/examples/tencentcloud-sms/variables.tf @@ -0,0 +1,3 @@ +variable "availability_zone" { + default = "ap-guangzhou-3" +} \ No newline at end of file diff --git a/examples/tencentcloud-sms/version.tf b/examples/tencentcloud-sms/version.tf new file mode 100644 index 0000000000..133d0d73e7 --- /dev/null +++ b/examples/tencentcloud-sms/version.tf @@ -0,0 +1,3 @@ +terraform { + required_version = ">= 0.12" +} \ No newline at end of file diff --git a/tencentcloud/data_source_tc_tcr_replication_instance_create_tasks_test.go b/tencentcloud/data_source_tc_tcr_replication_instance_create_tasks_test.go index 6b6aaf259f..672fb1257a 100644 --- a/tencentcloud/data_source_tc_tcr_replication_instance_create_tasks_test.go +++ b/tencentcloud/data_source_tc_tcr_replication_instance_create_tasks_test.go @@ -1,6 +1,7 @@ package tencentcloud import ( + "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -13,8 +14,8 @@ func TestAccTencentCloudTcrReplicationInstanceCreateTasksDataSource_basic(t *tes Providers: testAccProviders, Steps: []resource.TestStep{ { - // Config: fmt.Sprintf(testAccTcrReplicationInstance_create_tasks_and_sync_status_DataSource, "create-tasks-and-sync-status", time.Now().Nanosecond()), - Config: testAccTcrReplicationInstance_create_tasks_and_sync_status_DataSource, + Config: fmt.Sprintf(testAccTcrReplicationInstance_create_tasks_and_sync_status_DataSource, defaultTCRInstanceId, "tcr-aoz8mxoz-1-kkircm"), + // Config: testAccTcrReplicationInstance_create_tasks_and_sync_status_DataSource, PreConfig: func() { testAccStepSetRegion(t, "ap-shanghai") testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON) @@ -62,8 +63,8 @@ const testAccTcrReplicationInstance_create_tasks_and_sync_status_DataSource = ` // dst_region_id = tencentcloud_tcr_manage_replication_operation.my_replica.destination_region_id // } locals { - src_registry_id = "tcr-800uf6j9" - dst_registry_id = "tcr-800uf6j9-1-cgeafk" + src_registry_id = "%s" + dst_registry_id = "%s" dst_region_id = 1 } diff --git a/tencentcloud/resource_tc_ses_template.go b/tencentcloud/resource_tc_ses_template.go index 5d579c52cb..1b7b8b0d54 100644 --- a/tencentcloud/resource_tc_ses_template.go +++ b/tencentcloud/resource_tc_ses_template.go @@ -1,13 +1,15 @@ /* -Provides a resource to create a ses template +Provides a resource to create a ses template. Example Usage +Create a ses template instance + ```hcl -resource "tencentcloud_ses_template" "template" { - template_name = "sesTemplateName" +resource "tencentcloud_ses_template" "example" { + template_name = "tf_example_ses_temp"" template_content { - text = "This is the content of the test" + text = "example for the ses template" } } @@ -16,7 +18,7 @@ Import ses template can be imported using the id, e.g. ``` -$ terraform import tencentcloud_ses_template.template template_id +$ terraform import tencentcloud_ses_template.example template_id ``` */ package tencentcloud diff --git a/tencentcloud/resource_tc_sms_sign.go b/tencentcloud/resource_tc_sms_sign.go index 41908cf507..1faf2fdabf 100644 --- a/tencentcloud/resource_tc_sms_sign.go +++ b/tencentcloud/resource_tc_sms_sign.go @@ -3,14 +3,16 @@ Provides a resource to create a sms sign Example Usage +Create a sms sign instance + ```hcl -resource "tencentcloud_sms_sign" "sign" { - sign_name = "terraform" - sign_type = 1 - document_type = 4 - international = 0 - sign_purpose = 0 - proof_image = "dGhpcyBpcyBhIGV4YW1wbGU=" +resource "tencentcloud_sms_sign" "example" { + sign_name = "tf_example_sms_sign" + sign_type = 1 # 1:APP, DocumentType can be chosen(0,1,2,3,4) + document_type = 4 # Screenshot of application background management (personally developed APP) + international = 0 # Mainland China SMS + sign_purpose = 0 # personal use + proof_image = "your_proof_image" } ``` diff --git a/tencentcloud/resource_tc_sms_template.go b/tencentcloud/resource_tc_sms_template.go index 0a527bf66d..6e196ec13c 100644 --- a/tencentcloud/resource_tc_sms_template.go +++ b/tencentcloud/resource_tc_sms_template.go @@ -3,13 +3,15 @@ Provides a resource to create a sms template Example Usage +Create a sms template + ```hcl resource "tencentcloud_sms_template" "template" { - template_name = "Template By Terraform" - template_content = "Template Content" - international = 0 - sms_type = 0 - remark = "terraform test" + template_name = "tf_example_sms_template" + template_content = "example for sms template" + international = 0 # Mainland China SMS + sms_type = 0 # regular SMS + remark = "terraform example" } ``` diff --git a/website/docs/r/ses_template.html.markdown b/website/docs/r/ses_template.html.markdown index 1552030a14..c9be71fd7e 100644 --- a/website/docs/r/ses_template.html.markdown +++ b/website/docs/r/ses_template.html.markdown @@ -4,20 +4,22 @@ layout: "tencentcloud" page_title: "TencentCloud: tencentcloud_ses_template" sidebar_current: "docs-tencentcloud-resource-ses_template" description: |- - Provides a resource to create a ses template + Provides a resource to create a ses template. --- # tencentcloud_ses_template -Provides a resource to create a ses template +Provides a resource to create a ses template. ## Example Usage +### Create a ses template instance + ```hcl -resource "tencentcloud_ses_template" "template" { - template_name = "sesTemplateName" +resource "tencentcloud_ses_template" "example" { + template_name = "tf_example_ses_temp" " template_content { - text = "This is the content of the test" + text = " example for the ses template " } } ``` @@ -46,6 +48,6 @@ In addition to all arguments above, the following attributes are exported: ses template can be imported using the id, e.g. ``` -$ terraform import tencentcloud_ses_template.template template_id +$ terraform import tencentcloud_ses_template.example template_id ``` diff --git a/website/docs/r/sms_sign.html.markdown b/website/docs/r/sms_sign.html.markdown index 2d8493088a..ef0c838913 100644 --- a/website/docs/r/sms_sign.html.markdown +++ b/website/docs/r/sms_sign.html.markdown @@ -13,14 +13,16 @@ Provides a resource to create a sms sign ## Example Usage +### Create a sms sign instance + ```hcl -resource "tencentcloud_sms_sign" "sign" { - sign_name = "terraform" - sign_type = 1 - document_type = 4 - international = 0 - sign_purpose = 0 - proof_image = "dGhpcyBpcyBhIGV4YW1wbGU=" +resource "tencentcloud_sms_sign" "example" { + sign_name = "tf_example_sms_sign" + sign_type = 1 # 1:APP, DocumentType can be chosen(0,1,2,3,4) + document_type = 4 # Screenshot of application background management (personally developed APP) + international = 0 # Mainland China SMS + sign_purpose = 0 # personal use + proof_image = "your_proof_image" } ``` diff --git a/website/docs/r/sms_template.html.markdown b/website/docs/r/sms_template.html.markdown index 4c3b2f63f5..8bfdbc823b 100644 --- a/website/docs/r/sms_template.html.markdown +++ b/website/docs/r/sms_template.html.markdown @@ -13,13 +13,15 @@ Provides a resource to create a sms template ## Example Usage +### Create a sms template + ```hcl resource "tencentcloud_sms_template" "template" { - template_name = "Template By Terraform" - template_content = "Template Content" - international = 0 - sms_type = 0 - remark = "terraform test" + template_name = "tf_example_sms_template" + template_content = "example for sms template" + international = 0 # Mainland China SMS + sms_type = 0 # regular SMS + remark = "terraform example" } ```