Skip to content

Update terraform new resource docs #21140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from

Conversation

FingerLeader
Copy link
Contributor

@FingerLeader FingerLeader commented Jun 9, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot bot added the contribution This PR is from a community contributor. label Jun 9, 2025
Copy link

ti-chi-bot bot commented Jun 9, 2025

Hi @FingerLeader. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. missing-translation-status This PR does not have translation status info. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 9, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @FingerLeader, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new documentation for using the TiDB Cloud Terraform provider to manage Dedicated clusters. It provides step-by-step guides and examples for creating, modifying, importing, and deleting dedicated clusters and their components (like TiFlash and additional TiDB node groups) using Infrastructure as Code principles.

Highlights

  • New Documentation: Added a comprehensive new documentation page (tidb-cloud/terraform-use-dedicated-cluster-resource.md) detailing how to manage TiDB Cloud Dedicated clusters using the tidbcloud_dedicated_cluster Terraform resource.
  • Resource Management: The new document covers the full lifecycle of a dedicated cluster via Terraform, including creation, modification (adding TiFlash, scaling, pausing/resuming), adding/updating/deleting TiDB node groups, importing existing clusters, and deletion.
  • Terraform Examples: Includes detailed Terraform HCL code examples and corresponding terraform apply, terraform state show, and terraform show command outputs for each operation (create, modify, delete, import).
  • Data Source Usage: Explains how to use the tidbcloud_projects data source to retrieve project IDs necessary for cluster creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new documentation page for the tidbcloud_dedicated_cluster Terraform resource. The document is comprehensive, covering creation, modification (including TiFlash, scaling, pausing/resuming, and node group management), importing, and deleting dedicated clusters. It also explains how to use the tidbcloud_projects data source.

The review focuses on resolving TO DO items, ensuring consistency in examples (especially resource names like example_cluster), correcting internal links, improving the clarity of steps and explanations, and adhering to markdown and language style guidelines. Specific suggestions include rephrasing for formality and conciseness, and correcting list numbering for better logical flow.

Comment on lines 123 to 126
<!-- TO DO -->
> **Note:**
>
> Before you begin, make sure that you have set a CIDR in the TiDB Cloud console. For more information, see [Set a CIDR](/tidb-cloud/set-up-vpc-peering-connections.md#prerequisite-set-a-cidr-for-a-region). You can also [create a `dedicated_network_container` resource](xxxx) to manage your CIDR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This section contains a "TO DO" comment and a placeholder link (xxxx).

  1. Please remove the <!-- TO DO --> comment if there's no specific pending information for this exact spot.
  2. The link (xxxx) for dedicated_network_container resource needs to be updated with the correct URL if the document exists, or the sentence should be rephrased/removed if the resource or its documentation is not yet available.

Enter a value: yes

tidbcloud_dedicated_cluster.example_cluster: Creating...
tidbcloud_dedicated_cluster.example: Still creating... [10s elapsed]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The resource name in this example output is example, but the Terraform configuration (e.g., line 150) uses example_cluster. This inconsistency appears in several example outputs throughout the document. Please ensure all example outputs consistently use example_cluster to match the defined resource name.

Suggested change
tidbcloud_dedicated_cluster.example: Still creating... [10s elapsed]
tidbcloud_dedicated_cluster.example_cluster: Still creating... [10s elapsed]

Comment on lines 1053 to 1073
1. Add an import block for the new dedicated cluster resource

- Add the following import block to your `.tf` file, replace `example` with a desired resource name, and replace `${id}` with the cluster ID:

```
import {
to = tidbcloud_dedicated_cluster.example_cluster
id = "${id}"
}
```
2. Generate the new configuration file

Generate the new configuration file for the new dedicated cluster resource according to the import block:

```shell
terraform plan -generate-config-out=generated.tf
```

Do not specify an existing `.tf` file name in the preceding command. Otherwise, Terraform will return an error.

1. Review and apply the generated configuration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The numbering for the steps under "Import a cluster" is inconsistent. Step "1. Add an import block..." is followed by sub-step "- Add the following...". Then step "2. Generate..." is followed by a step incorrectly numbered as "1. Review and apply...". This should be "3. Review and apply...". Please ensure consistent and sequential numbering for steps.

```
$ terraform state show tidbcloud_dedicated_cluster.example_cluster

# tidbcloud_cluster.example_cluster:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment in the example output refers to tidbcloud_cluster.example_cluster. Since this document is about the dedicated cluster resource, it should be tidbcloud_dedicated_cluster.example_cluster. Please check and correct this in all similar example outputs.

Suggested change
# tidbcloud_cluster.example_cluster:
# tidbcloud_dedicated_cluster.example_cluster:


### Add a TiFlash component

1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-cluster-using-the-cluster-resource), add the `tiflash_node_setting` configuration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The anchor #create-a-cluster-using-the-cluster-resource appears to be from a different document. It should point to the relevant section within this document for creating a dedicated cluster. This issue also occurs on lines 571, 677, and 832.

A possible correct anchor would be #create-a-dedicated-cluster-using-the-dedicated-cluster-resource.

Suggested change
1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-cluster-using-the-cluster-resource), add the `tiflash_node_setting` configuration.
1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-dedicated-cluster-using-the-dedicated-cluster-resource), add the `tiflash_node_setting` configuration.


## Delete a Dedicated cluster

To delete a Dedicated cluster, you can delete the configuration of the `dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

For consistency with the resource name used elsewhere, this should be tidbcloud_dedicated_cluster resource.

Suggested change
To delete a Dedicated cluster, you can delete the configuration of the `dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource:
To delete a Dedicated cluster, you can delete the configuration of the `tidbcloud_dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource:

Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
@hfxsd hfxsd self-assigned this Jun 10, 2025
@hfxsd hfxsd self-requested a review June 10, 2025 07:54
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Copy link

ti-chi-bot bot commented Jun 10, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from hfxsd. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

FingerLeader and others added 2 commits June 10, 2025 16:20
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: FingerLeader <[email protected]>
@hfxsd hfxsd added translation/doing This PR's assignee is translating this PR. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. and removed missing-translation-status This PR does not have translation status info. labels Jun 10, 2025
Signed-off-by: FingerLeader <[email protected]>
@FingerLeader FingerLeader changed the base branch from master to release-8.1 June 13, 2025 06:44
@FingerLeader FingerLeader changed the base branch from release-8.1 to master June 13, 2025 06:46

## Prerequisites

- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) at least v0.4.0.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) at least v0.4.0.
- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) v0.4.0 or later.

@FingerLeader
Copy link
Contributor Author

this PR reopen in #21189

@FingerLeader FingerLeader deleted the update-terraform branch June 16, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. translation/doing This PR's assignee is translating this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants