Terraform
info
You can enable the extra with the :LazyExtras
command.
Plugins marked as optional will only be configured if they are installed.
Alternatively, you can add it to your lazy.nvim
imports
lua/config/lazy.lua
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.terraform" },
{ import = "plugins" },
},
})
Below you can find a list of included plugins and their default settings.
caution
You don't need to copy the default settings to your config. They are only shown here for reference.
nvim-treesitter
- Options
- Full Spec
opts = { ensure_installed = { "terraform", "hcl" } }
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "terraform", "hcl" } },
}
nvim-lspconfig
- Options
- Full Spec
opts = {
servers = {
terraformls = {},
},
}
{
"neovim/nvim-lspconfig",
opts = {
servers = {
terraformls = {},
},
},
}
mason.nvim
ensure terraform tools are installed
- Options
- Full Spec
opts = { ensure_installed = { "tflint" } }
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "tflint" } },
}
telescope-terraform-doc.nvim
- Options
- Full Spec
opts = {}
{
"ANGkeith/telescope-terraform-doc.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform_doc")
end)
end,
}
telescope-terraform.nvim
- Options
- Full Spec
opts = {}
{
"cappyzawa/telescope-terraform.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform")
end)
end,
}
none-ls.nvim (optional)
- Options
- Full Spec
opts = function(_, opts)
local null_ls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
null_ls.builtins.formatting.packer,
null_ls.builtins.formatting.terraform_fmt,
null_ls.builtins.diagnostics.terraform_validate,
})
end
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local null_ls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
null_ls.builtins.formatting.packer,
null_ls.builtins.formatting.terraform_fmt,
null_ls.builtins.diagnostics.terraform_validate,
})
end,
}
nvim-lint (optional)
- Options
- Full Spec
opts = {
linters_by_ft = {
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
},
}
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
},
},
}
conform.nvim (optional)
- Options
- Full Spec
opts = {
formatters_by_ft = {
hcl = { "packer_fmt" },
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
["terraform-vars"] = { "terraform_fmt" },
},
}
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
hcl = { "packer_fmt" },
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
["terraform-vars"] = { "terraform_fmt" },
},
},
}
telescope.nvim (optional)
- Options
- Full Spec
opts = nil
{
"nvim-telescope/telescope.nvim",
optional = true,
specs = {
{
"ANGkeith/telescope-terraform-doc.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform_doc")
end)
end,
},
{
"cappyzawa/telescope-terraform.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform")
end)
end,
},
},
}