| name | provider-fix-documentation |
| description | Fix documentation issues in Terraform Provider resources. Covers attribute value corrections, description updates, example fixes, and documentation consistency checks. |
| metadata | {"version":"1.0.0","domain":"terraform-provider","triggers":"fix documentation, update docs, correct attribute values, documentation error, wrong description"} |
Fix Provider Documentation
Fix documentation issues in Terraform Provider resources, including incorrect attribute values, outdated descriptions, missing information, or inconsistencies between code and documentation.
Requirement Sources
Requirements may come from:
- User's direct description
- An Aone workitem link
- A GitLab Code Review link
- User-reported documentation errors
If the user provides a link, use the link-info-extractor skill to extract requirement details first:
task(category="quick", load_skills=["link-info-extractor"], ...)
Step 1: Identify the Issue
Common documentation issues include:
- Incorrect attribute values — Valid values in docs don't match schema validation
- Outdated descriptions — API behavior changed but docs weren't updated
- Missing attributes — New attributes added to code but not documented
- Wrong examples — Example code doesn't match current API or schema
- Inconsistent terminology — Different terms used for same concept across docs
- Deprecated attributes — Old attributes still documented without deprecation notice
Step 2: Locate Target Files
Find the documentation file:
website/docs/r/<product>_<resource>.html.markdown — Resource documentation
website/docs/d/<product>_<resource>.html.markdown — Data source documentation
Find the corresponding code file for verification:
alicloud/resource_alicloud_<product>_<resource>.go — Schema definition
alicloud/data_source_alicloud_<product>_<resource>.go — Data source schema
Step 3: Verify Against Code
For Attribute Value Issues
-
Find the schema definition in the Go file:
"attribute_name": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: StringInSlice([]string{"Value1", "Value2"}, false),
}
-
Check the validation function — The values in StringInSlice are the actual valid values
-
Check conversion functions — Look for mapping between Terraform values and API values:
if value == "Value1" {
request.ApiValue = "api_value_1"
}
if response.ApiValue == "api_value_1" {
terraformValue = "Value1"
}
-
Compare with documentation — The docs should list the Terraform-side values (what users configure), NOT the API-side values
For Description Issues
- Check the schema
Description field (if present)
- Check API documentation via Alibaba Cloud OpenAPI Explorer
- Verify against actual behavior in test files
Step 4: Fix Documentation
Rules
- Use Terraform-side values — Document the values users configure in Terraform, not internal API values
- Match schema exactly — Valid values must match
ValidateFunc in schema
- Clear mapping notes — If there's a mapping between Terraform and API values, document it clearly
- Consistent formatting — Follow existing documentation style:
* `attribute_name` - (Optional, Computed) Description. Supported values:
- `Value1`: Description of value 1
- `Value2`: Description of value 2
- Mark deprecated attributes — Add deprecation notice with version and replacement:
* `old_attribute` - (Optional, Deprecated since v1.261.0) Description. Use `new_attribute` instead.
- Update available-since version — For new attributes, add version info:
* `new_attribute` - (Optional, Available since v1.267.0) Description.
Common Fixes
Fix 1: Incorrect Valid Values
Before:
* `payment_type` - (Optional) Billing method. Supported values:
- `prepaid`: Subscription
- `postpaid`: Pay-as-you-go
After:
* `payment_type` - (Optional) Billing method. Supported values:
- `PayAsYouGo`: Pay-as-you-go
- `Subscription`: Subscription
Fix 2: Missing Deprecation Notice
Before:
* `instance_charge_type` - (Optional) Instance charge type.
After:
* `instance_charge_type` - (Optional, Deprecated since v1.261.0) Instance charge type. Use `payment_type` instead.
Fix 3: Incomplete Value Descriptions
Before:
* `status` - (Optional) Instance status. Valid values: Active, Inactive.
After:
* `status` - (Optional) Instance status. Supported values:
- `Active`: Instance is active and running
- `Inactive`: Instance is stopped
Step 5: Verify
- Check consistency — Ensure all similar attributes follow the same documentation pattern
- Verify values — Cross-reference with schema
ValidateFunc in code
- Check examples — If examples use the attribute, ensure they use correct values
- Search for related mentions — Grep for the attribute name to find all mentions:
grep -r "attribute_name" website/docs/
Step 6: Commit Changes
git status && git diff
make commit
git push origin fix/<brief_description>
Commit message format:
docs(<resource_name>): fix <attribute_name> documentation
- Correct valid values from <old_values> to <new_values>
- Update description to match schema definition
Closes: <requirement_url>
Step 7: Run CI Checks (MANDATORY)
After committing, you MUST run CI checks and ensure all pass:
make ci-check-quick
Checkpoint:
- ✅
make ci-check-quick exits with code 0
- ✅ No errors or warnings related to your changes
- ✅ Markdown linting passes
- ✅ Documentation format validation passes
If CI checks fail:
- Read the error message carefully
- Fix the reported issues
- Amend the commit:
git commit --amend
- Re-run
make ci-check-quick
- Repeat until all checks pass
DO NOT skip this step or push code that fails CI checks.
Important Notes
- Terraform values vs API values — Users configure Terraform values, not API values. The provider handles mapping internally.
- Check conversion functions — If values are mapped, ensure docs show Terraform-side values
- Schema is source of truth — When in doubt, trust the schema
ValidateFunc over existing docs
- Test files as reference — Acceptance tests show actual valid values in use
- Don't change code — This skill is for documentation fixes only. If code is wrong, use
provider-add-attribute skill
Acceptance Criteria
- Documentation matches schema definition exactly
- Valid values are correct and complete
- Descriptions are clear and accurate
- Consistent formatting with rest of documentation
- Deprecation notices added where needed
- All mentions of the attribute are updated consistently
make ci-check-quick passes with exit code 0 (MANDATORY)
Example Workflow
Issue: User reports documentation error for payment_type
- Read the workitem to understand the reported issue
- Find the schema in
resource_alicloud_elasticsearch_instance.go:
"payment_type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: StringInSlice([]string{"PayAsYouGo", "Subscription"}, false),
}
- Find the docs in
website/docs/r/elasticsearch_instance.html.markdown
- Compare — Docs say
prepaid/postpaid, schema says PayAsYouGo/Subscription
- Fix docs — Update to show correct Terraform values
- Verify — Check no other mentions need updating
- Git Commit — Single commit with clear message
- CI Check — Run
make ci-check-quick and ensure all checks pass ✅