rixrix
vscode-terraform-snippets
JavaScript

Advanced Terraform Snippets for Visual Studio Code. It has at least 23k downloads from the marketplace.

Last updated Dec 9, 2025
51
Stars
30
Forks
23
Issues
0
Stars/day
Attention Score
21
Language breakdown
No language data available.
Files click to expand
README

News

## I'm looking for volunteers to help me maintain this project. I don't have enough time to do some of the work.

Advanced Terraform Snippets for Visual Studio Code

Provides 550+ code snippets of Hashicorp's Terraform cloud orchestration tool for Visual Studio Code.

Usage

Type part of the snippets tf, press enter:

Sample Snippets

Input / Output / Module

tf-variable                         // generates variable "myVariable" { }
tf-variable-default                 // generates variable "myVariable" { default = ""}
tf-output                           // generates output "myOutputName" { value = ""}
tf-module                           // generates module "myModuleName" { source = ""}
tf-module-github                    // generates module "myModuleName" { source = "github.com/username"}
tf-module-github-private            // generates module "myModuleName" { source = "git::https://MACHINE-USER:MACHINE-PASS@github.com/username"}
tf-module-bitbucket                 // generates module "myModuleName" { source = "bitbucket.org/username"}
tf-module-git                       // generates module "myModuleName" { source = "git://"}
tf-module-mercurial                 // generates module "myModuleName" { source = "hg::http://"}
tf-module-s3                        // generates module "myModuleName" { source = "s3::https://"}

Providers

tf-aws                              // generates provider "aws" { ... }
tf-aws-profile                       // generates provider "aws" { profile = "", sharedcredentialsfile="",... }
tf-azurerm                          // generates provider "azurerm" { ... }
tf-google                           // generates provider "google" { ... }
tf-openstack                        // generates provider "openstack" { ... }
tf-ibm_provider                     // generates provider "ibm" { ... }

Backends / Remote State

tf-backend-azure                    // generates data "terraformremotestate" "xxx" { backend = "azure" ... }
tf-backend-s3                       // generates data "terraformremotestate" "xxx" { backend = "s3" ... }
tf-backend-gcs                      // generates data "terraformremotestate" "xxx" { backend = "gcs" ... }
tf-backend-consul                   // generates data "terraformremotestate" "xxx" { backend = "consul" ... }

Handy shortcuts for AWS Regions

tf-aws-region-us-east-1             // generates US East (N.Virginia) us-east-1
tf-aws-region-ap-south-1            // generates Asia Pacific (Mumbai) ap-south-1

plus all other AWS regions

Others + more, see supported list

tf-dependson                       // generates dependson []
tf-provisioner-connection           // generates provisioner "file" { ... }
tf-provisioner-file                 // generates provisioner "file" { ... }
tf-provisioner-local-exec           // generates provisioner "local-exec" { ... }
tf-provisioner-remote-exec          // generates provisioner "remote-exec" { ... }
tf-provisioner-nullresource        // generates resource "nullresource" { ... }
tf-templatefile                    // generates data "templatefile" "init" { ... }
tf-templatefile-inline             // generates data "templatefile" "init" { ... } inline
tf-templatecloudinitconfig        // generates data "templatecloudinitconfig" "config" { ... } inline

Use Extension

Alternatively, press Ctrl+Space (Windows, Linux) or Cmd+Space (OSX) to activate snippets from within the editor.

Supported Snippets

Input, Output, Module

Provisioners

Providers

  • Amazon Web Services, Google Cloud, Microsoft Azure, CloudStack
  • Consul, Docker, Heroku, DigitalOcean, Bitbucket
  • GitHub, Archive, Atlas, Chef, Cloudflare
  • MySQL, PostgreSQL, SoftLayer, Scaleway, CenturyLinkCloud
  • Cobbler, Datadog, DNSMadeEasy, DNSimple, Dyn
  • Fastly, Grafana, InfluxDB, Librato, Logentries
  • Mailgun, Packet, PagerDuty, PowerDNS, RabbitMQ
  • Random, Rundeck, StatusCake, Terraform, TLS,
  • Triton, UltraDNS, OpenStack, VMware vCloud Director, VMware vSphere
  • GitLab, Arukas, New Relic, Kubernetes, Vault, OpsGenie, IBM Cloud

Backends / Remote State

  • Artifactory, Atlas, Microsoft Azure Storage, Consul, Etcd,
  • Google Cloud Storage, Http, Local, Manta, Amazon S3, Openstack Swift

Requirements / Dependencies

Install the Terraform Language support extension from the marketplace published by "Mikael Olenfalk"

Installation

  • Install Visual Studio Code 1.x or higher
  • Launch Code
  • From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX)
  • Select Install Extension
  • Choose the extension
  • Reload Visual Studio Code

Development

How to build

  • npm run build:snippets
- Generates a single file in "snippets/terraform.json" from "src/" snippets file.

Convention

- All commit logs must follow the "Conventional Changelog" convention, particularly "angular" preset. see https://github.com/conventional-changelog/conventional-changelog

How can you help ?

It is super easy, the snippets for each Terraform features are self-contained into its own single JSON file.

src/
    backends/
    configuration/
    modules/
    state/
    provisioners/
    providers/
        aws.json
        chef.json
        your-new-feature-here.json

Issues / Comments / Suggestions

Feel free to file an issue or submit a pull request at https://github.com/rixrix/vscode-terraform-snippets/issues

Notes

Contributors

License

MIT

🔗 More in this category

© 2026 GitRepoTrend · rixrix/vscode-terraform-snippets · Updated daily from GitHub