💻 Coding
Terraform Module README and Examples Locked to Provider Version
Write a Terraform module README plus examples pinned to a named provider version. No invented resources, outputs, or newer provider APIs.
0Reviews
Prompt
Act as a Terraform module maintainer writing README and examples for Terraform 1.9.x. You document only resources, variables, and outputs in Inputs. You lock the provider version they name. You do not invent cloud resources, and you do not use provider APIs newer than the pin. You work only from Inputs. You do not invent stats, citations, quotes, URLs, names, or records that are not in Inputs. Inputs: - Module name and source path: [Module] - Terraform version constraint: [TfVer] - Provider name and exact version pin: [Provider] - Variables with type, default, and description: [Vars] - Resources the module actually creates: [Resources] - Outputs with names and descriptions: [Outputs] - Required IAM or cloud permissions I can prove: [Perms] - Example call sites I allow (count): [Examples] - Known limitations: [Limits] - Words I must not use: [Banned] Generate: 1. Version lock: quote TfVer and Provider. List APIs you refuse because they are newer than the pin. 2. README title, short description, and a requirements table (Terraform, provider, pin). 3. Usage example: a complete module block using only Vars. No extra arguments. 4. Inputs table and Outputs table from Vars and Outputs only. Mark missing descriptions as NOT IN INPUTS. 5. Resources section: one line per item in Resources. Do not add a data source that was not listed. 6. Examples folder sketch: filenames and what each example proves, count limited to Examples. 7. Limitations and upgrade notes from Limits only. 8. Compliance pass: quote Banned words, invented resources, or unpinned latest. Cut them. Constraints: - HashiCorp Terraform 1.9.x language. Do not write OpenTofu-only features unless Inputs say OpenTofu. - Provider version is a pin, not a range you widen. - Never invent an output, variable, or resource address. - Do not paste fake terraform plan output or invented apply times. - Examples must apply with only the listed Vars.
Instructions
Replace every [bracket] with your details before running. Works on ChatGPT, Claude, and Gemini.
Examples
Example Input
Module: s3-access-log-bucket, source ./modules/s3-access-log-bucket TfVer: >= 1.9.0, < 1.10.0 Provider: hashicorp/aws 5.68.0 exactly Vars: bucket_name (string, no default); force_destroy (bool, default false); kms_key_arn (string, default null, if set enable SSE-KMS) Resources: aws_s3_bucket.this; aws_s3_bucket_server_side_encryption_configuration.this; aws_s3_bucket_public_access_block.this Outputs: bucket_id; bucket_arn Perms: s3:CreateBucket, s3:PutEncryptionConfiguration, s3:PutBucketPublicAccessBlock. No kms:CreateKey. Examples: 2 (sse-s3 default; sse-kms when kms_key_arn set) Limits: no replication; no object lock; no inventory; no directory buckets Banned: production ready, works with any provider, latest AWS
Example Output
1. Version lock. Terraform >= 1.9.0, < 1.10.0. hashicorp/aws = 5.68.0. Refuse directory buckets, provider 5.69+ attributes, google_ and azurerm_ resources. Do not widen the pin to >= 5.68.0.
2. README. s3-access-log-bucket. Creates one S3 bucket meant for access logs, with encryption config and public access block. Requirements: Terraform 1.9.x; hashicorp/aws 5.68.0.
3. Usage. module "logs" { source = "./modules/s3-access-log-bucket" bucket_name = var.log_bucket_name force_destroy = false }. Optional kms_key_arn for SSE-KMS. No lifecycle argument: not in Vars.
4. Inputs. bucket_name string required. force_destroy bool default false. kms_key_arn string default null. Outputs. bucket_id and bucket_arn from aws_s3_bucket.this. No bucket_domain_name: NOT IN INPUTS.
5. Resources. aws_s3_bucket.this. aws_s3_bucket_server_side_encryption_configuration.this. aws_s3_bucket_public_access_block.this. No aws_s3_bucket_logging, no aws_kms_key.
6. Examples. examples/sse-s3: omit kms_key_arn. examples/sse-kms: set kms_key_arn to an existing key ARN. Count is 2. Do not add a replication example.
7. Limitations. No replication, object lock, or inventory. Module does not call kms:CreateKey. Directory buckets are out of scope. Stay on aws 5.68.0 until the pin changes in Inputs.
8. Compliance. Cut: production ready, works with any provider, latest AWS. No fake plan. No invented output.
Recap against Inputs: Use only facts from the example input. Missing fields stay labeled missing. Do not backfill numbers, quotes, or names.