-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
0 deletions.
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,12 @@ | ||
bucket = "terraform-demo-beijing" #存储桶名称 | ||
key = "terraform-demo-beijing/terraform.tfstate" #对象名称 | ||
region = "cn-beijing" #存储桶所在地域 | ||
endpoints = { | ||
s3 = "https://tos-s3-cn-beijing.volces.com" #TOS的S3域名 | ||
} | ||
|
||
skip_region_validation = true | ||
skip_metadata_api_check = true | ||
skip_credentials_validation = true | ||
skip_requesting_account_id = true | ||
skip_s3_checksum = true |
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,20 @@ | ||
module "network" { | ||
source = "../../modules/network" | ||
|
||
vpc_name = var.vpc_name | ||
vpc_cidr = var.vpc_cidr | ||
subnet_name = var.subnet_name | ||
subnet_cidr = var.subnet_cidr | ||
zone_id = var.zone_id | ||
bandwidth = 2 | ||
} | ||
|
||
module "ecs" { | ||
source = "../../modules/ecs" | ||
|
||
subnet_id = module.network.subnet_id | ||
security_group_ids = [module.network.security_group_id] | ||
associate_eip = true | ||
eip_id = module.network.eip_id | ||
image_id = var.image_id | ||
} |
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,16 @@ | ||
terraform { | ||
required_version = ">= 1.6.0" | ||
|
||
required_providers { | ||
volcengine = { | ||
source = "volcengine/volcengine" | ||
version = "=0.0.156" | ||
} | ||
} | ||
|
||
backend "s3" {} | ||
} | ||
|
||
provider "volcengine" { | ||
region = var.region | ||
} |
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,9 @@ | ||
region = "cn-beijing" | ||
vpc_name = "tf-test-vpc-demo" | ||
vpc_cidr = "172.16.0.0/16" | ||
subnet_name = "tf-test-subnet-demo" | ||
subnet_cidr = "172.16.0.0/24" | ||
zone_id = "cn-beijing-a" | ||
|
||
instance_name_prefix = "tf-test-ecs-demo-" | ||
image_id = "image-ybqi99s7yq8rx7mnk44b" |
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,76 @@ | ||
## Network | ||
variable "region" { | ||
type = string | ||
} | ||
|
||
variable "vpc_name" { | ||
default = "tf-demo-vpc" | ||
} | ||
|
||
variable "vpc_cidr" { | ||
default = "172.16.0.0/16" | ||
} | ||
|
||
variable "zone_id" { | ||
type = string | ||
default = "cn-beijing-a" | ||
} | ||
|
||
variable "subnet_name" { | ||
type = string | ||
default = "tf-demo-subnet" | ||
} | ||
|
||
variable "subnet_cidr" { | ||
type = string | ||
default = "172.16.0.0/24" | ||
} | ||
|
||
variable "bandwidth" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
## ECS | ||
|
||
variable "instance_name_prefix" { | ||
description = "Instance name prefix, will be used to generate unique instance name. Will be ignored if var.instance_name is specified" | ||
type = string | ||
default = "tf-prefix-" | ||
} | ||
|
||
variable "instance_type" { | ||
description = "Instance type" | ||
type = string | ||
default = "ecs.g1.large" | ||
} | ||
|
||
variable "image_id" { | ||
description = "The Image ID of ECS instance" | ||
type = string | ||
} | ||
|
||
variable "system_volume_type" { | ||
description = "Valid values: PTSSD, ESSD_PL0, ESSD_PL1, ESSD_PL2, ESSD_FlexPL etc." | ||
type = string | ||
default = "ESSD_PL0" | ||
} | ||
|
||
variable "system_volume_size" { | ||
description = "System volume size" | ||
type = string | ||
default = 40 | ||
} | ||
|
||
variable "password" { | ||
description = "The Password of ECS instance" | ||
nullable = true | ||
sensitive = true | ||
default = null | ||
} | ||
|
||
variable "associate_eip" { | ||
description = "Whether associate the Eip for ECS instance" | ||
type = bool | ||
default = false | ||
} |