Go to file
Martin Atkins efe78b2910 main: new global option -chdir
This new option is intended to address the previous inconsistencies where
some older subcommands supported partially changing the target directory
(where Terraform would use the new directory inconsistently) where newer
commands did not support that override at all.

Instead, now Terraform will accept a -chdir command at the start of the
command line (before the subcommand) and will interpret it as a request
to direct all actions that would normally be taken in the current working
directory into the target directory instead. This is similar to options
offered by some other similar tools, such as the -C option in "make".

The new option is only accepted at the start of the command line (before
the subcommand) as a way to reflect that it is a global command (not
specific to a particular subcommand) and that it takes effect _before_
executing the subcommand. This also means it'll be forced to appear before
any other command-specific arguments that take file paths, which hopefully
communicates that those other arguments are interpreted relative to the
overridden path.

As a measure of pragmatism for existing uses, the path.cwd object in
the Terraform language will continue to return the _original_ working
directory (ignoring -chdir), in case that is important in some exceptional
workflows. The path.root object gives the root module directory, which
will always match the overriden working directory unless the user
simultaneously uses one of the legacy directory override arguments, which
is not a pattern we intend to support in the long run.

As a first step down the deprecation path, this commit adjusts the
documentation to de-emphasize the inconsistent old command line arguments,
including specific guidance on what to use instead for the main three
workflow commands, but all of those options remain supported in the same
way as they were before. In a later commit we'll make those arguments
produce a visible deprecation warning in Terraform's output, and then
in an even later commit we'll remove them entirely so that -chdir is the
single supported way to run Terraform from a directory other than the
one containing the root module configuration.
2020-09-04 15:31:08 -07:00
.circleci add test for 'full' docker image build 2020-06-17 10:48:10 -04:00
.github remove local SECURITY.md in favor of org-wide policy 2020-08-24 15:45:32 -07:00
addrs addrs: Resource.InModule, similar to Resource.Absolute 2020-08-24 11:41:28 -07:00
backend backend/http: add support for configuration by environment variable (#25439) 2020-09-02 08:35:08 -04:00
builtin always return original workspace, even when null 2020-06-24 13:41:51 -04:00
command main: new global option -chdir 2020-09-04 15:31:08 -07:00
communicator communicator/winrm: include configured timeout in winrm server 2020-06-25 08:41:09 -04:00
configs core: Remove the last few HIL remnants 2020-09-02 15:53:33 -07:00
contrib contrib: Remove api-coverage tool 2019-10-18 11:22:30 -07:00
dag quote dot node names 2020-06-15 13:28:53 -04:00
digraph Fix TestWriteDot random order error 2014-07-29 10:26:50 -07:00
docs docs: Provider protocol wire format for values 2020-09-01 10:40:36 -07:00
e2e main: new global option -chdir 2020-09-04 15:31:08 -07:00
examples Fix Google Cloud Platform name across docs. 2019-01-15 12:10:20 -08:00
experiments configs: Custom variable validation is no longer experimental 2020-05-28 16:07:59 -07:00
flatmap prune references to config/module 2019-08-07 17:50:59 -04:00
helper core: Remove the last few HIL remnants 2020-09-02 15:53:33 -07:00
httpclient Merge pull request #22272 from hashicorp/f-httpclient-ua 2019-08-12 20:20:03 +01:00
instances Expander.ExpandResource cannot expand all modules 2020-03-25 11:58:23 -04:00
internal command: Add redirect support to 0.13upgrade 2020-08-31 14:53:35 -04:00
lang lang: Add test for jsonencode entity escaping 2020-09-04 09:18:52 -04:00
moduledeps rename provider-specific functions (#24417) 2020-03-20 13:59:59 -04:00
plans Unknown set blocks with dynamic may have 0 elems 2020-07-23 15:47:34 -04:00
plugin plugin/discovery: Remove dead code 2020-05-28 15:20:41 -04:00
providers Remove terraform.ResourceProvider, use providercache.Installer instead 2020-04-06 09:24:23 -07:00
provisioners provisioners: Add Factory type and FactoryFixed helper 2018-10-16 19:14:11 -07:00
registry registry: Fix panic when server is unreachable 2020-03-19 10:20:10 -04:00
repl fix error output in repl test 2020-04-14 14:50:43 -04:00
scripts use alpine:latest as the base image for terraform docker containers 2020-07-01 16:03:06 -04:00
states states: Add roundtrip v3->v4 with builtin provider 2020-08-14 15:40:48 -04:00
terraform main: new global option -chdir 2020-09-04 15:31:08 -07:00
tfdiags tfdiags: Diagnostics.ToHCL 2020-03-12 11:11:29 -07:00
tools terraform-bundle: initial changelog (#25917) 2020-08-19 15:20:07 -04:00
vendor deps: bump go-cty version (#26079) 2020-09-03 11:01:15 -04:00
version version: Main branch is now tracking 0.14.0 2020-09-03 09:34:51 -04:00
website main: new global option -chdir 2020-09-04 15:31:08 -07:00
.gitignore Coverage 2020-03-03 13:01:05 -05:00
.go-version build: Use go 1.14.7 2020-08-25 12:37:08 -04:00
.hashibot.hcl Remove hashibot panic issue labeler 2020-05-13 11:58:57 -07:00
.tfdev .tfdev: remove platform build constraint 2019-08-09 15:10:52 -07:00
CHANGELOG.md Update CHANGELOG.md 2020-09-03 16:06:43 -04:00
CODEOWNERS Add remilapeyre to CODEOWNERS 2020-08-19 14:25:19 +02:00
Dockerfile build: Don't create apk cache in "full" docker image 2019-11-11 16:04:23 -08:00
LICENSE Adding license 2014-07-28 13:54:06 -04:00
Makefile Fix missing VERSION for running make website 2020-08-12 13:24:03 -04:00
README.md Added links to Learn and certification exams to the README 2020-03-27 11:25:06 -07:00
checkpoint.go Remove config.go and update things using its aliases 2020-01-13 16:50:05 -05:00
codecov.yml build: disable github pr annotations (#25942) 2020-08-20 13:06:48 -04:00
commands.go main: new global option -chdir 2020-09-04 15:31:08 -07:00
go.mod deps: bump go-cty version (#26079) 2020-09-03 11:01:15 -04:00
go.sum deps: bump go-cty version (#26079) 2020-09-03 11:01:15 -04:00
help.go main: new global option -chdir 2020-09-04 15:31:08 -07:00
main.go main: new global option -chdir 2020-09-04 15:31:08 -07:00
main_test.go main: make configuration available when initializing commands 2017-09-29 14:03:09 -07:00
panic.go main: Warn about potential sensitive information in logs when panicking 2019-11-06 14:12:33 -08:00
plugins.go Remove config.go and update things using its aliases 2020-01-13 16:50:05 -05:00
provider_source.go internal/getproviders: HTTPMirrorSource implementation 2020-08-26 13:18:08 -07:00
signal_unix.go Forward SIGTERM and handle that as an interrupt 2016-12-08 12:20:25 -05:00
signal_windows.go Forward SIGTERM and handle that as an interrupt 2016-12-08 12:20:25 -05:00
synchronized_writers.go main: synchronize writes to VT100-faker on Windows 2017-05-04 15:36:51 -07:00
version.go states/statemgr: Fix the Filesystem state manager tests 2018-11-19 09:02:35 -08:00

README.md

Terraform

Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

The key features of Terraform are:

  • Infrastructure as Code: Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.

  • Execution Plans: Terraform has a "planning" step where it generates an execution plan. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure.

  • Resource Graph: Terraform builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.

  • Change Automation: Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors.

For more information, see the introduction section of the Terraform website.

Getting Started & Documentation

Documentation is available on the Terraform website:

If you're new to Terraform and want to get started creating infrastructure, please check out our Getting Started guides on HashiCorp's learning platform. There are also additional guides to continue your learning.

Show off your Terraform knowledge by passing a certification exam. Visit the certification page for information about exams and find study materials on HashiCorp's learning platform.

Developing Terraform

This repository contains only Terraform core, which includes the command line interface and the main graph engine. Providers are implemented as plugins that each have their own repository in the terraform-providers organization on GitHub. Instructions for developing each provider are in the associated README file. For more information, see the provider development overview.

To learn more about compiling Terraform and contributing suggested changes, please refer to the contributing guide.

License

Mozilla Public License v2.0