Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8f871fb
feat/update-example-sean
SevenEarth Jul 11, 2023
7894ecc
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 12, 2023
d5d8644
feat/update-example-sean
SevenEarth Jul 17, 2023
b499538
feat/update-example-sean
SevenEarth Jul 18, 2023
0fa5a12
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 21, 2023
1ffac6e
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 21, 2023
10a43ce
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 24, 2023
6f6215b
feat/update-example-sean
SevenEarth Jul 24, 2023
816b6a2
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 27, 2023
962d039
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 28, 2023
07f03ef
feat/update-example-sean
SevenEarth Jul 31, 2023
a12b6c6
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 31, 2023
d8cdfb5
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 31, 2023
3ae1ab7
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Jul 31, 2023
e79f083
feat/update-example-sean
SevenEarth Jul 31, 2023
dd12fc2
feat/update-example-sean
SevenEarth Aug 1, 2023
f5f214d
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Aug 1, 2023
e8b2a1e
feat/update-example-sean
SevenEarth Aug 1, 2023
edd1c76
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Aug 1, 2023
860958a
Merge branch 'master' of github.com:tencentcloudstack/terraform-provi…
SevenEarth Aug 10, 2023
a878979
feat/update-example-sean
SevenEarth Aug 10, 2023
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
93 changes: 11 additions & 82 deletions examples/tencentcloud-as/main.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
resource "tencentcloud_vpc" "vpc" {
name = "tf-as-vpc"
cidr_block = "10.2.0.0/16"
data "tencentcloud_images" "example" {
image_type = ["PUBLIC_IMAGE"]
os_name = "TencentOS Server 3.2 (Final)"
}

resource "tencentcloud_subnet" "subnet" {
vpc_id = tencentcloud_vpc.vpc.id
name = "tf-as-subnet"
cidr_block = "10.2.11.0/24"
availability_zone = var.availability_zone
}

resource "tencentcloud_as_scaling_config" "launch_configuration" {
configuration_name = "tf-as-configuration"
image_id = "img-9qabwvbn"
instance_types = [var.instance_type]
resource "tencentcloud_as_scaling_config" "example" {
configuration_name = "example-launch-configuration"
image_id = data.tencentcloud_images.example.images.0.image_id
instance_types = ["SA1.SMALL1"]
project_id = 0
system_disk_type = "CLOUD_PREMIUM"
system_disk_size = "50"
Expand All @@ -26,76 +19,12 @@ resource "tencentcloud_as_scaling_config" "launch_configuration" {
internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
internet_max_bandwidth_out = 10
public_ip_assigned = true
password = "test123#"
password = "Test@123#"
enhanced_security_service = false
enhanced_monitor_service = false
user_data = "test"
user_data = "dGVzdA=="

instance_tags = {
tag = "as"
tag = "example"
}
}

resource "tencentcloud_as_scaling_group" "scaling_group" {
scaling_group_name = "tf-as-scaling-group"
configuration_id = tencentcloud_as_scaling_config.launch_configuration.id
max_size = var.max_size
min_size = var.min_size
vpc_id = tencentcloud_vpc.vpc.id
subnet_ids = [tencentcloud_subnet.subnet.id]
project_id = 0
default_cooldown = 400
desired_capacity = var.desired_capacity
termination_policies = ["NEWEST_INSTANCE"]
retry_policy = "INCREMENTAL_INTERVALS"

tags = {
"test" = "test"
}
}

resource "tencentcloud_as_scaling_policy" "scaling_policy" {
scaling_group_id = tencentcloud_as_scaling_group.scaling_group.id
policy_name = "tf-as-scaling-policy"
adjustment_type = "EXACT_CAPACITY"
adjustment_value = 2
comparison_operator = "GREATER_THAN"
metric_name = "CPU_UTILIZATION"
threshold = 80
period = 300
continuous_time = 10
statistic = "AVERAGE"
cooldown = 360
}

resource "tencentcloud_as_schedule" "schedule" {
scaling_group_id = tencentcloud_as_scaling_group.scaling_group.id
schedule_action_name = "tf-as-schedule"
max_size = var.max_size
min_size = var.min_size
desired_capacity = var.desired_capacity
start_time = "2020-01-01T00:00:00+08:00"
end_time = "2020-12-01T00:00:00+08:00"
recurrence = "0 0 */1 * *"
}

resource "tencentcloud_as_lifecycle_hook" "lifecycle_hook" {
scaling_group_id = tencentcloud_as_scaling_group.scaling_group.id
lifecycle_hook_name = "tf-as-lifecycle"
lifecycle_transition = "INSTANCE_TERMINATING"
default_result = "ABANDON"
heartbeat_timeout = 300
notification_metadata = "tf lifecycle test"
notification_target_type = "CMQ_QUEUE"
notification_queue_name = "notification"
}

resource "tencentcloud_as_notification" "notification" {
scaling_group_id = tencentcloud_as_scaling_group.scaling_group.id
notification_types = ["SCALE_OUT_FAILED"]
notification_user_group_ids = ["76955"]
}

data "tencentcloud_as_scaling_groups" "scaling_groups_tags" {
tags = tencentcloud_as_scaling_group.scaling_group.tags
}
}
23 changes: 0 additions & 23 deletions examples/tencentcloud-as/variables.tf
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
variable "availability_zone" {
default = "ap-guangzhou-3"
}

variable "instance_type" {
default = "SA1.SMALL1"
}

variable "min_size" {
default = 0
}

variable "max_size" {
default = 5
}

variable "desired_capacity" {
default = 0
}

variable "cvm_product" {
default = "cvm"
}
108 changes: 35 additions & 73 deletions examples/tencentcloud-mysql/main.tf
Original file line number Diff line number Diff line change
@@ -1,84 +1,46 @@
resource "tencentcloud_mysql_instance" "main" {
mem_size = 1000
volume_size = 50
instance_name = "testAccMysql"
engine_version = "5.7"
root_password = "test1234"
availability_zone = var.availability_zone
internet_service = 1
slave_sync_mode = 1
intranet_port = 3360

tags = {
purpose = "for test"
}

parameters = {
max_connections = "1000"
}
}

resource "tencentcloud_mysql_readonly_instance" "readonly" {
master_instance_id = tencentcloud_mysql_instance.main.id
mem_size = 1000
volume_size = 50
instance_name = "testAccMysql_readonly"
intranet_port = 3360
data "tencentcloud_availability_zones" "zones" {}

tags = {
purpose = "for test"
}
resource "tencentcloud_vpc" "vpc" {
name = "vpc-mysql"
cidr_block = var.vpc_cidr
}

data "tencentcloud_mysql_parameter_list" "mysql" {
mysql_id = tencentcloud_mysql_instance.main.id
resource "tencentcloud_subnet" "subnet" {
availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name
name = "subnet-mysql"
vpc_id = tencentcloud_vpc.vpc.id
cidr_block = var.subnet_cidr
is_multicast = false
}

resource "tencentcloud_mysql_account" "mysql_account" {
mysql_id = tencentcloud_mysql_instance.main.id
name = "test"
password = "test1234"
description = "for test"
resource "tencentcloud_security_group" "security_group" {
name = "sg-mysql"
description = "mysql test"
}

resource "tencentcloud_mysql_privilege" "privilege" {
mysql_id = tencentcloud_mysql_instance.main.id
account_name = tencentcloud_mysql_account.mysql_account.name
global = ["TRIGGER"]
database {
privileges = ["SELECT", "INSERT", "UPDATE", "DELETE", "CREATE"]
database_name = "sys"
}
database {
privileges = ["SELECT"]
database_name = "performance_schema"
}

table {
privileges = ["SELECT", "INSERT", "UPDATE", "DELETE", "CREATE"]
database_name = "mysql"
table_name = "slow_log"
}
resource "tencentcloud_mysql_instance" "example" {
internet_service = 1
engine_version = "5.7"
charge_type = "POSTPAID"
root_password = "PassWord123"
slave_deploy_mode = 1
availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name
first_slave_zone = data.tencentcloud_availability_zones.zones.zones.1.name
slave_sync_mode = 1
instance_name = "tf-example-mysql"
mem_size = 4000
volume_size = 200
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
intranet_port = 3306
security_groups = [tencentcloud_security_group.security_group.id]

table {
privileges = ["SELECT", "INSERT", "UPDATE"]
database_name = "mysql"
table_name = "user"
tags = {
name = "test"
}

column {
privileges = ["SELECT", "INSERT", "UPDATE", "REFERENCES"]
database_name = "mysql"
table_name = "user"
column_name = "host"
parameters = {
character_set_server = "utf8"
max_connections = "1000"
}
}

resource "tencentcloud_mysql_backup_policy" "mysql_backup_policy" {
mysql_id = tencentcloud_mysql_instance.main.id
retention_period = 56
backup_model = "physical"
backup_time = "10:00-14:00"
}


}
8 changes: 6 additions & 2 deletions examples/tencentcloud-mysql/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
variable "availability_zone" {
default = "ap-guangzhou-3"
variable "vpc_cidr" {
default = "10.0.0.0/16"
}

variable "subnet_cidr" {
default = "10.0.0.0/16"
}
26 changes: 26 additions & 0 deletions examples/tencentcloud-nat-gateway/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "tencentcloud_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
name = "tf_nat_gateway_vpc"
}

resource "tencentcloud_eip" "eip_example1" {
name = "tf_nat_gateway_eip1"
}

resource "tencentcloud_eip" "eip_example2" {
name = "tf_nat_gateway_eip2"
}

resource "tencentcloud_nat_gateway" "example" {
name = "tf_example_nat_gateway"
vpc_id = tencentcloud_vpc.vpc.id
bandwidth = 100
max_concurrent = 1000000
assigned_eip_set = [
tencentcloud_eip.eip_example1.public_ip,
tencentcloud_eip.eip_example2.public_ip,
]
tags = {
tf_tag_key = "tf_tag_value"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12"
}
terraform {
required_version = ">= 0.12"
}
Loading