Skip to content

Commit

Permalink
change provider username/password to public_key/private_key (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyangyu authored Oct 14, 2022
1 parent 6a40014 commit 2d63b5a
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 124 deletions.
63 changes: 32 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@ For general information about Terraform, visit the [official website](https://ww

## TOC

- [Requirements](#requirements)
- [Support](#support)
- [Using the provider](#using-the-provider)
* [Set up](#set-up)
* [Create an API key](#create-an-api-key)
* [Get TiDB Cloud provider](#get-tidb-cloud-provider)
* [Config the provider](#config-the-provider)
* [Get projectId with project Data Source](#get-projectid-with-project-data-source)
* [Get cluster spec info with cluster-spec Data Source](#get-cluster-spec-info-with-cluster-spec-data-source)
* [Create a dedicated cluster with cluster resource](#create-a-dedicated-cluster-with-cluster-resource)
* [Change the dedicated cluster](#change-the-dedicated-cluster)
* [Create a backup with backup resource](#create-a-backup-with-backup-resource)
* [Create a restore task with restore resource](#create-a-restore-task-with-restore-resource)
* [Importing the restore cluster](#importing-the-restore-cluster)
* [Destroy the dedicated cluster](#destroy-the-dedicated-cluster)
- [Developing the Provider](#developing-the-provider)
* [Environment](#environment)
* [Building the provider from source](#building-the-provider-from-source)
* [Generate or update documentation in docs file](#generate-or-update-documentation-in-docs-file)
* [Running the acceptance test](#running-the-acceptance-test)
* [Debug the provider](#debug-the-provider)
- [Follow us](#follow-us)
* [Twitter](#twitter)
- [License](#license)
- [Terraform TiDB Cloud Provider](#terraform-tidb-cloud-provider)
- [TOC](#toc)
- [Requirements](#requirements)
- [Support](#support)
- [Using the provider](#using-the-provider)
- [Set up](#set-up)
- [Create an API key](#create-an-api-key)
- [Get TiDB Cloud provider](#get-tidb-cloud-provider)
- [Config the provider](#config-the-provider)
- [Get projectId with project Data Source](#get-projectid-with-project-data-source)
- [Get cluster spec info with cluster-spec Data Source](#get-cluster-spec-info-with-cluster-spec-data-source)
- [Create a dedicated cluster with cluster resource](#create-a-dedicated-cluster-with-cluster-resource)
- [Change the dedicated cluster](#change-the-dedicated-cluster)
- [Create a backup with backup resource](#create-a-backup-with-backup-resource)
- [Create a restore task with restore resource](#create-a-restore-task-with-restore-resource)
- [Importing the restore cluster](#importing-the-restore-cluster)
- [Destroy the dedicated cluster](#destroy-the-dedicated-cluster)
- [Developing the Provider](#developing-the-provider)
- [Environment](#environment)
- [Building the provider from source](#building-the-provider-from-source)
- [Generate or update documentation in docs file](#generate-or-update-documentation-in-docs-file)
- [Running the acceptance test](#running-the-acceptance-test)
- [Debug the provider](#debug-the-provider)
- [Follow us](#follow-us)
- [License](#license)


## Requirements
Expand Down Expand Up @@ -142,16 +143,16 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
```

username and password are the API key's public key and private key, you can also pass them with the environment:
public_key and private_key are the API key's public key and private key, you can also pass them with the environment:

```
export TIDBCLOUD_USERNAME = ${public_key}
export TIDBCLOUD_PASSWORD = ${private_key}
export TIDBCLOUD_PUBLIC_KEY = ${public_key}
export TIDBCLOUD_PRIVATE_KEY = ${private_key}
```

Now, you can use the tidbcloud provider!
Expand All @@ -176,8 +177,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
data "tidbcloud_project" "example_project" {
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
data "tidbcloud_backup" "example" {
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/cluster_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
data "tidbcloud_cluster_spec" "example" {
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
data "tidbcloud_project" "example" {
Expand Down
25 changes: 24 additions & 1 deletion docs/data-sources/restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,30 @@ description: |-

restore data source


## Example Usage

```terraform
terraform {
required_providers {
tidbcloud = {
source = "tidbcloud/tidbcloud"
}
}
}
provider "tidbcloud" {
public_key = "fake_public_key"
private_key = "fake_private_key"
}
data "tidbcloud_restore" "example" {
project_id = "fake_id"
}
output "output" {
value = data.tidbcloud_restore.example
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
```

Expand All @@ -36,5 +36,5 @@ provider "tidbcloud" {

### Optional

- `password` (String, Sensitive) Private Key
- `username` (String, Sensitive) Public Key
- `private_key` (String, Sensitive) Private Key
- `public_key` (String, Sensitive) Public Key
4 changes: 2 additions & 2 deletions docs/resources/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
resource "tidbcloud_backup" "example" {
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
resource "tidbcloud_cluster" "dedicated_tier_cluster" {
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ terraform {
}
provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
resource "tidbcloud_restore" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/data-sources/tidbcloud_backup/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

data "tidbcloud_backup" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/data-sources/tidbcloud_cluster_spec/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

data "tidbcloud_cluster_spec" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/data-sources/tidbcloud_project/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

data "tidbcloud_project" "example" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

data "tidbcloud_restore" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}
4 changes: 2 additions & 2 deletions examples/resources/tidbcloud_backup/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

resource "tidbcloud_backup" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/resources/tidbcloud_cluster/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

resource "tidbcloud_cluster" "dedicated_tier_cluster" {
Expand Down
4 changes: 2 additions & 2 deletions examples/resources/tidbcloud_restore/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ terraform {
}

provider "tidbcloud" {
username = "fake_username"
password = "fake_password"
public_key = "fake_public_key"
private_key = "fake_private_key"
}

resource "tidbcloud_restore" "example" {
Expand Down
10 changes: 5 additions & 5 deletions internal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
## Auth
You need to set API Key with environment before all the tests
```
export TIDBCLOUD_USERNAME=${public_key}
export TIDBCLOUD_PASSWORD=${private_key}
export TIDBCLOUD_PUBLIC_KEY=${public_key}
export TIDBCLOUD_PRIVATE_KEY=${private_key}
```

## Test With Project
Expand All @@ -25,7 +25,7 @@ Here are the steps to test them:

2. set projectId with environment
```
export TIDBCLOUD_PROJECTID=${your_project_id}
export TIDBCLOUD_PROJECT_ID=${your_project_id}
```
3. test
```
Expand All @@ -41,8 +41,8 @@ Here are the steps to test them:

2. set projectId and clusterId with environment
```
export TIDBCLOUD_PROJECTID=${your_project_id}
export TIDBCLOUD_CLUSTERID=${your_cluster_id}
export TIDBCLOUD_PROJECT_ID=${your_project_id}
export TIDBCLOUD_CLUSTER_ID=${your_cluster_id}
```

3. test
Expand Down
Loading

0 comments on commit 2d63b5a

Please sign in to comment.