-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sync option for cluster create (#136)
--------- Co-authored-by: Xiang Zhang <[email protected]>
- Loading branch information
1 parent
2f7eb07
commit a66f4c5
Showing
12 changed files
with
235 additions
and
42 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 |
---|---|---|
|
@@ -35,3 +35,4 @@ website/vendor | |
|
||
test.tf | ||
.terraform.lock.hcl | ||
.terraform.tfstate.lock.info |
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
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
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
56 changes: 56 additions & 0 deletions
56
examples/workflows/tidbcloud_serverless_using_project_name/main.tf
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,56 @@ | ||
variable "project_name" { | ||
type = string | ||
nullable = false | ||
default = "default_project" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "cloud_provider_region" { | ||
type = string | ||
nullable = false | ||
default = "us-east-1" | ||
} | ||
|
||
variable "password" { | ||
type = string | ||
nullable = false | ||
sensitive = true | ||
} | ||
|
||
terraform { | ||
required_providers { | ||
tidbcloud = { | ||
source = "tidbcloud/tidbcloud" | ||
} | ||
} | ||
} | ||
|
||
provider "tidbcloud" { | ||
# export TIDBCLOUD_PUBLIC_KEY and TIDBCLOUD_PRIVATE_KEY with the TiDB Cloud API Key | ||
sync = true | ||
} | ||
|
||
data "tidbcloud_projects" "projects" { | ||
page_size = "50" | ||
} | ||
|
||
locals { | ||
project_id = { | ||
value = element([for s in data.tidbcloud_projects.projects.items : s.id if s.name == var.project_name], 0) | ||
} | ||
} | ||
|
||
resource "tidbcloud_cluster" "example" { | ||
project_id = local.project_id.value | ||
name = var.cluster_name | ||
cluster_type = "DEVELOPER" | ||
cloud_provider = "AWS" | ||
region = var.cloud_provider_region | ||
config = { | ||
root_password = var.password | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/workflows/tidbcloud_serverless_using_project_name/terraform.tfvars.templates
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 @@ | ||
cluster_name = "cluster0" | ||
password = "12345678" | ||
project_name = "project_name" |
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.