Dev
Terraform Resource Block Generator
When writing Terraform for a resource type you have not used recently, the documentation round-trip — find the provider, read the required arguments, adapt the example — breaks the flow. This generator returns valid HCL for four common AWS resources, with the arguments and supporting blocks you almost always need. One input controls the output: the Resource dropdown — AWS S3 bucket, AWS EC2 instance, AWS security group, or AWS IAM role. The S3 bucket block includes a bucket name, tags, and a companion versioning resource. EC2 includes an AMI placeholder, instance type t3.micro, and tags. The security group includes ingress on 443, open egress, and a description. The IAM role includes an assume-role policy using jsonencode with an EC2 principal. Paste into a .tf file, replace placeholder values with your real names and identifiers, and run terraform plan to preview before applying.
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Pick the cloud resource you need.
- Click Generate to produce the HCL block.
- Paste it into a .tf file and replace placeholders.
- Run terraform plan to preview the change.
Use Cases
- •Scaffolding a Terraform module quickly
- •Recalling the exact argument names a resource needs
- •Teaching Terraform structure to a teammate
- •Standardising tags across infrastructure
- •Avoiding a round trip to the provider documentation
Tips
- →Never commit real secrets — use variables and a secrets backend.
- →Pin the provider version in a required_providers block.
- →Run terraform fmt to keep formatting consistent.
- →Use remote state so a team can collaborate safely.
FAQ
which AWS resources does the generator support
Four: an S3 bucket (with a companion versioning resource), an EC2 instance, a security group (with ingress on 443 and open egress), and an IAM role (with an EC2 assume-role policy using jsonencode).
is the output ready to run with terraform apply
No. The structure and arguments are correct HCL, but placeholder values — bucket name, AMI ID, CIDR ranges — must be replaced. You also need a configured provider block and backend. Run terraform plan to review before applying.
why include tags in the resource blocks
Tags like Environment and ManagedBy label cloud resources for cost tracking and ownership identification. Including them in the starter makes tagging the default rather than an afterthought. Adjust the tag keys and values to match your organisation's policy.
can I use the patterns for Azure or GCP
The generated HCL targets AWS. The HCL syntax — resource blocks, argument assignment, nested blocks — is the same across providers, but resource types and argument names differ and require the relevant provider documentation.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.