-
Notifications
You must be signed in to change notification settings - Fork 450
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
API docs: Add docs to Terraform backends #1268
Comments
@ansgarm I am interested in working on this. Can you plz guide ? |
Hi @aayushharwani-aidash 👋 Wow! That's great! I'll use the S3 backend as an example, but feel free to pick your favorite(s) – you also don't have to do all at once to get a PR accepted and merged 🙂 Our backends can be found here and the docs on them are here. So let's take the The backend has a terraform-cdk/packages/cdktf/lib/backends/s3-backend.ts Lines 40 to 44 in 537c7da
The docs contain descriptions for those config keys. For example for the
A docstring for this property could look like this: export interface S3BackendProps {
// ...
/**
* AWS Region of the S3 Bucket and DynamoDB Table (if used). This can also
* be sourced from the AWS_DEFAULT_REGION and AWS_REGION environment
* variables.
*/
readonly region?: string;
// ... Note: The docs state that the region is required to be set, but in our code Besides adding docstrings to the properties, it is also useful to add a general docstring to the S3Backend class itself: terraform-cdk/packages/cdktf/lib/backends/s3-backend.ts Lines 9 to 12 in 537c7da
The introductory section of the backend docs seems to fit quite well. And adding a link to the docs allows the user to access more information if required. /**
* Stores the state as a given key in a given bucket on Amazon S3. This backend
* also supports state locking and consistency checking via Dynamo DB, which
* can be enabled by setting the dynamodb_table field to an existing DynamoDB
* table name. A single DynamoDB table can be used to lock multiple remote
* state files. Terraform generates key names that include the values of the
* bucket and key variables.
*
* Warning! It is highly recommended that you enable Bucket Versioning on the
* S3 bucket to allow for state recovery in the case of accidental deletions
* and human error.
*
* Read more about this backend in the Terraform docs:
* https://www.terraform.io/language/settings/backends/s3
*/
export class S3Backend extends TerraformBackend {
constructor(scope: Construct, private readonly props: S3BackendProps) {
super(scope, "backend", "s3");
}
// ... If there's anything left unclear, feel free to ask! I hope this explains what we had in mind here. |
Thanks @ansgarm , I got your point. |
Community Note
Description
There are currently no docstrings on the constructs we have for Terraform backends.
See this one for example: https://github.com/hashicorp/terraform-cdk/blob/main/packages/cdktf/lib/backends/s3-backend.ts
It should at least include a link to https://www.terraform.io/docs/language/settings/backends/s3.html
References
The text was updated successfully, but these errors were encountered: