You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TEO (EdgeOne) `IncreasePlanQuota` API allows users to purchase additional quotas for their EdgeOne plans. The API is sychronous (not async), takes three required input parameters (`PlanId`, `QuotaType`, `QuotaNumber`), and returns a `DealName` (order number).
4
+
5
+
This is a one-time operation resource (RESOURCE_KIND_OPERATION): after calling the API, no state needs to be tracked — there's no resource lifecycle beyond the operation itself.
6
+
7
+
The vendor directory already contains the TEO v20220901 SDK with `IncreasePlanQuotaRequest`, `IncreasePlanQuotaResponse`, and the corresponding client method.
- Provide a Terraform resource `tencentcloud_teo_increase_plan_quota` that calls the `IncreasePlanQuota` API
15
+
- Support all three input parameters: `plan_id`, `quota_type`, `quota_number`
16
+
- Expose the response `deal_name` as a computed output
17
+
- Follow the established OPERATION resource pattern (Create does the work, Read/Delete are no-ops)
18
+
19
+
**Non-Goals:**
20
+
- No polling (the API is synchronous, not async)
21
+
- No import support (OPERATION resources don't support import)
22
+
- No update support (OPERATION resources are one-time only)
23
+
24
+
## Decisions
25
+
26
+
### 1. Resource Type: RESOURCE_KIND_OPERATION
27
+
**Rationale**: `IncreasePlanQuota` is a one-time purchase operation. There's no resource to manage after the call completes. OPERATION resources have empty Read/Delete and use `helper.BuildToken()` for the ID.
28
+
29
+
### 2. Use Direct API Call (Not Service Layer)
30
+
**Rationale**: For simple OPERATION resources that don't need complex logic or reuse, calling the SDK client directly from the resource file (like `resource_tc_teo_check_cname_status_operation.go`) is simpler and follows the existing pattern. No need for a separate service layer method.
31
+
32
+
### 3. Schema Design
33
+
All three input parameters are `Required` + `ForceNew` since the operation must be idempotent and re-triggered on any change. The output `deal_name` is `Computed` only.
34
+
35
+
### 4. Retry with WriteRetryTimeout
36
+
**Rationale**: Since this is a write operation (not a read), use `tccommon.WriteRetryTimeout` for the retry block. This aligns with other OPERATION resources that perform API calls in Create.
37
+
38
+
### 5. Error Handling
39
+
- Check for nil response after API call, return `NonRetryableError` if response is nil
40
+
- Use `tccommon.RetryError()` wrapper for retriable API errors
41
+
- Log with appropriate debug/critical levels following existing patterns
42
+
43
+
## Risks / Trade-offs
44
+
45
+
-**Risk**: The API may fail due to insufficient balance or invalid quota type → **Mitigation**: Error is surfaced to the user via Terraform's standard error reporting
46
+
-**Risk**: Duplicate calls could create duplicate orders → **Mitigation**: This is managed by the cloud API's own idempotency; the Terraform resource is ForceNew on all params so repeated applies only re-trigger on changes
TEO (EdgeOne) users need the ability to increase plan quotas (e.g., site count, precise access control rules, rate limiting rules) through Terraform. Currently, the terraform provider lacks this capability, forcing users to manually use the console or API to purchase additional quotas. This change adds a Terraform OPERATION resource for the `IncreasePlanQuota` API, enabling Infrastructure-as-Code management of TEO plan quota upgrades.
4
+
5
+
## What Changes
6
+
7
+
- Add a new RESOURCE_KIND_OPERATION resource `tencentcloud_teo_increase_plan_quota` that calls the `IncreasePlanQuota` API
8
+
- The resource is a one-time operation: it creates (calls the API), and read/delete are no-ops as expected for OPERATION resources
9
+
- Input parameters: `plan_id`, `quota_type`, `quota_number` (all required and ForceNew)
10
+
- Output parameter: `deal_name` (computed) - the order number returned by the API
11
+
- Register the new resource in `tencentcloud/provider.go` and `tencentcloud/provider.md`
12
+
13
+
## Capabilities
14
+
15
+
### New Capabilities
16
+
-`teo-increase-plan-quota`: Terraform resource for the TEO `IncreasePlanQuota` API, enabling users to increase plan quotas for TEO EdgeOne plans via Infrastructure-as-Code
The system SHALL provide a Terraform resource `tencentcloud_teo_increase_plan_quota` that calls the TEO `IncreasePlanQuota` API to purchase additional plan quotas.
5
+
6
+
#### Scenario: Successful quota increase
7
+
-**WHEN** a user applies a configuration with valid `plan_id`, `quota_type`, and `quota_number`
8
+
-**THEN** the provider calls the `IncreasePlanQuota` API and returns the `deal_name` (order number) as a computed attribute
9
+
10
+
#### Scenario: Missing required parameter
11
+
-**WHEN** a user applies a configuration without `plan_id`, `quota_type`, or `quota_number`
12
+
-**THEN** Terraform returns a validation error before calling the API
13
+
14
+
#### Scenario: API returns an error
15
+
-**WHEN** the `IncreasePlanQuota` API call fails (e.g., insufficient balance, invalid quota type)
16
+
-**THEN** the provider returns the API error to the user with retry on retriable errors
17
+
18
+
#### Scenario: API returns nil response
19
+
-**WHEN** the `IncreasePlanQuota` API call returns a nil response
20
+
-**THEN** the provider returns a non-retryable error indicating the response was nil
21
+
22
+
#### Scenario: OPERATION resource read is no-op
23
+
-**WHEN** Terraform performs a read (refresh) on the `tencentcloud_teo_increase_plan_quota` resource
24
+
-**THEN** the read function returns nil without modifying state
25
+
26
+
#### Scenario: OPERATION resource delete is no-op
27
+
-**WHEN** Terraform performs a delete on the `tencentcloud_teo_increase_plan_quota` resource
28
+
-**THEN** the delete function returns nil without performing any API call
-[ ] 1.1 Create `tencentcloud/services/teo/resource_tc_teo_increase_plan_quota_operation.go` with schema definition (plan_id, quota_type, quota_number as Required+ForceNew; deal_name as Computed), Create function calling IncreasePlanQuota API with retry, and empty Read/Delete functions
4
+
5
+
## 2. Unit Tests
6
+
7
+
-[ ] 2.1 Create `tencentcloud/services/teo/resource_tc_teo_increase_plan_quota_operation_test.go` with unit tests using gomonkey to mock the IncreasePlanQuota API call, covering successful creation, API error, and nil response scenarios
8
+
9
+
## 3. Provider Registration
10
+
11
+
-[ ] 3.1 Register the new resource `tencentcloud_teo_increase_plan_quota` in `tencentcloud/provider.go` (add to ResourcesMap)
12
+
-[ ] 3.2 Register the new resource in `tencentcloud/provider.md` (add to the TEO resources list)
13
+
14
+
## 4. Documentation
15
+
16
+
-[ ] 4.1 Create `tencentcloud/services/teo/resource_tc_teo_increase_plan_quota_operation.md` with description, Example Usage, and Import sections following the existing TEO resource doc format
17
+
18
+
## 5. Validation
19
+
20
+
-[ ] 5.1 Run `go test -gcflags=all=-l` on the unit test file to verify tests pass
21
+
-[ ] 5.2 Verify the code compiles successfully (via `go build` check in later steps)
The system SHALL provide a Terraform resource `tencentcloud_teo_increase_plan_quota` that calls the TEO `IncreasePlanQuota` API to purchase additional plan quotas.
5
+
6
+
#### Scenario: Successful quota increase
7
+
-**WHEN** a user applies a configuration with valid `plan_id`, `quota_type`, and `quota_number`
8
+
-**THEN** the provider calls the `IncreasePlanQuota` API and returns the `deal_name` (order number) as a computed attribute
9
+
10
+
#### Scenario: Missing required parameter
11
+
-**WHEN** a user applies a configuration without `plan_id`, `quota_type`, or `quota_number`
12
+
-**THEN** Terraform returns a validation error before calling the API
13
+
14
+
#### Scenario: API returns an error
15
+
-**WHEN** the `IncreasePlanQuota` API call fails (e.g., insufficient balance, invalid quota type)
16
+
-**THEN** the provider returns the API error to the user with retry on retriable errors
17
+
18
+
#### Scenario: API returns nil response
19
+
-**WHEN** the `IncreasePlanQuota` API call returns a nil response
20
+
-**THEN** the provider returns a non-retryable error indicating the response was nil
21
+
22
+
#### Scenario: OPERATION resource read is no-op
23
+
-**WHEN** Terraform performs a read (refresh) on the `tencentcloud_teo_increase_plan_quota` resource
24
+
-**THEN** the read function returns nil without modifying state
25
+
26
+
#### Scenario: OPERATION resource delete is no-op
27
+
-**WHEN** Terraform performs a delete on the `tencentcloud_teo_increase_plan_quota` resource
28
+
-**THEN** the delete function returns nil without performing any API call
0 commit comments