From a74faed5811e5d5be62ddf6a652f0a0336ea4e7b Mon Sep 17 00:00:00 2001 From: Zheng Xi Zhou Date: Fri, 18 Feb 2022 17:06:11 +0800 Subject: [PATCH] Add Terraform Configuration examples Add TF examples for GCP and Tecent Cloud Signed-off-by: Zheng Xi Zhou --- examples/tf-native/gcp/hcl/bucket.tf | 12 +++++-- examples/tf-native/tencent/vpc/main.tf | 47 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 examples/tf-native/tencent/vpc/main.tf diff --git a/examples/tf-native/gcp/hcl/bucket.tf b/examples/tf-native/gcp/hcl/bucket.tf index b487e429..4a97bd77 100644 --- a/examples/tf-native/gcp/hcl/bucket.tf +++ b/examples/tf-native/gcp/hcl/bucket.tf @@ -1,11 +1,19 @@ resource "google_storage_bucket" "bucket" { - name = var.bucket + name = var.bucket + location = var.location } output "BUCKET_URL" { value = google_storage_bucket.bucket.url + description = "Bucket URL" } variable "bucket" { - default = "vela-website" + description = "The name of the storage bucket to create" + type = "string" } + +variable "location" { + description = "The location of the storage bucket to create" + type = "string" +} \ No newline at end of file diff --git a/examples/tf-native/tencent/vpc/main.tf b/examples/tf-native/tencent/vpc/main.tf new file mode 100644 index 00000000..e3bcdfa6 --- /dev/null +++ b/examples/tf-native/tencent/vpc/main.tf @@ -0,0 +1,47 @@ +terraform { + required_providers { + tencentcloud = { + source = "tencentcloudstack/tencentcloud" + } + } +} + +resource "tencentcloud_vpc" "vpc" { + name = var.vpc_name + cidr_block = var.vpc_cidr + is_multicast = var.vpc_is_multicast + dns_servers = length(var.vpc_dns_servers) > 0 ? var.vpc_dns_servers : null + tags = var.vpc_tags +} + +variable "vpc_name" { + description = "The vpc name used to launch a new vpc when 'vpc_id' is not specified." + default = "tf-modules-vpc" +} + +variable "vpc_cidr" { + description = "The cidr block used to launch a new vpc when 'vpc_id' is not specified." + default = "172.16.0.0/16" +} + +variable "vpc_is_multicast" { + description = "Specify the vpc is multicast when 'vpc_id' is not specified." + default = true +} + +variable "vpc_dns_servers" { + description = "Specify the vpc dns servers when 'vpc_id' is not specified." + type = list(string) + default = [] +} + +variable "vpc_tags" { + description = "Additional tags for the vpc." + type = map(string) + default = {} +} + +output "VPC_ID" { + description = "The id of vpc." + value = tencentcloud_vpc.vpc.id +} \ No newline at end of file