This project is mirrored from https://:*****@github.com/hashicorp/terraform.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
  1. 17 Jun, 2022 1 commit
    • Martin Atkins's avatar
      Experiments supported only in alpha/dev builds · fda05795
      Martin Atkins authored
      We originally introduced the idea of language experiments as a way to get
      early feedback on not-yet-proven feature ideas, ideally as part of the
      initial exploration of the solution space rather than only after a
      solution has become relatively clear.
      
      Unfortunately, our tradeoff of making them available in normal releases
      behind an explicit opt-in in order to make it easier to participate in the
      feedback process had the unintended side-effect of making it feel okay
      to use experiments in production and endure the warnings they generate.
      This in turn has made us reluctant to make use of the experiments feature
      lest experiments become de-facto production features which we then feel
      compelled to preserve even though we aren't yet ready to graduate them
      to stable features.
      
      In an attempt to tweak that compromise, here we make the availability of
      experiments _at all_ a build-time flag which will not be set by default,
      and therefore experiments will not be available in most release builds.
      
      The intent (not yet implemented in this PR) is for our release process to
      set this flag only when it knows it's building an alpha release or a
      development snapshot not destined for release at all, which will therefore
      allow us to still use the alpha releases as a vehicle for giving feedback
      participants access to a feature (without needing to install a Go
      toolchain) but will not encourage pretending that these features are
      production-ready before they graduate from experimental.
      
      Only language experiments have an explicit framework for dealing with them
      which outlives any particular experiment, so most of the changes here are
      to that generalized mechanism. However, the intent is that non-language
      experiments, such as experimental CLI commands, would also in future
      check Meta.AllowExperimentalFeatures and gate the use of those experiments
      too, so that we can be consistent that experimental features will never
      be available unless you explicitly choose to use an alpha release or
      a custom build from source code.
      
      Since there are already some experiments active at the time of this commit
      which were not previously subject to this restriction, we'll pragmatically
      leave those as exceptions that will remain generally available for now,
      and so this new approach will apply only to new experiments started in the
      future. Once those experiments have all concluded, we will be left with
      no more exceptions unless we explicitly choose to make an exception for
      some reason we've not imagined yet.
      
      It's important that we be able to write tests that rely on experiments
      either being available or not being available, so here we're using our
      typical approach of making "package main" deal with the global setting
      that applies to Terraform CLI executables while making the layers below
      all support fine-grain selection of this behavior so that tests with
      different needs can run concurrently without trampling on one another.
      
      As a compromise, the integration tests in the terraform package will
      run with experiments enabled _by default_ since we commonly need to
      exercise experiments in those tests, but they can selectively opt-out
      if they need to by overriding the loader setting back to false again.
      fda05795
  2. 05 Nov, 2021 1 commit
    • Martin Atkins's avatar
      main: Report version information for "interesting" dependencies · 5ac1074c
      Martin Atkins authored
      We have a few dependencies that are such a significant part of Terraform's
      behavior that they will often be the root cause of or the solution to a
      bug reported against Terraform.
      
      As a small quality-of-life improvement to help with diagnosing those,
      we'll now report the selected versions for each of these so-called
      "interesting" dependencies as part of our initial trace log output during
      Terraform startup.
      
      The goal here is that when someone opens a bug report, and includes the
      trace log as our bug report template requests, we'll be able to see at a
      glance which versions of these dependencies were involved, instead of
      having to manually cross-reference in the go.mod file of the reported main
      Terraform CLI version.
      
      This does slightly grow the general overhead of the logs, but as long as
      we keep this set of interesting dependencies relatively small it shouldn't
      present any significant problem in typical usage.
      5ac1074c
  3. 28 Oct, 2021 3 commits
  4. 24 Jun, 2021 1 commit
  5. 18 May, 2021 1 commit
  6. 17 May, 2021 4 commits
    • Martin Atkins's avatar
      Move command/ to internal/command/ · ffe056ba
      Martin Atkins authored
      This is part of a general effort to move all of Terraform's non-library
      package surface under internal in order to reinforce that these are for
      internal use within Terraform only.
      
      If you were previously importing packages under this prefix into an
      external codebase, you could pin to an earlier release tag as an interim
      solution until you've make a plan to achieve the same functionality some
      other way.
      ffe056ba
    • Martin Atkins's avatar
      Move addrs/ to internal/addrs/ · b9a93a0f
      Martin Atkins authored
      This is part of a general effort to move all of Terraform's non-library
      package surface under internal in order to reinforce that these are for
      internal use within Terraform only.
      
      If you were previously importing packages under this prefix into an
      external codebase, you could pin to an earlier release tag as an interim
      solution until you've make a plan to achieve the same functionality some
      other way.
      b9a93a0f
    • Martin Atkins's avatar
      Move httpclient/ to internal/httpclient/ · 4c254cc2
      Martin Atkins authored
      This is part of a general effort to move all of Terraform's non-library
      package surface under internal in order to reinforce that these are for
      internal use within Terraform only.
      
      If you were previously importing packages under this prefix into an
      external codebase, you could pin to an earlier release tag as an interim
      solution until you've make a plan to achieve the same functionality some
      other way.
      4c254cc2
    • Martin Atkins's avatar
      Move backend/ to internal/backend/ · 73dda868
      Martin Atkins authored
      This is part of a general effort to move all of Terraform's non-library
      package surface under internal in order to reinforce that these are for
      internal use within Terraform only.
      
      If you were previously importing packages under this prefix into an
      external codebase, you could pin to an earlier release tag as an interim
      solution until you've make a plan to achieve the same functionality some
      other way.
      73dda868
  7. 31 Mar, 2021 1 commit
  8. 26 Jan, 2021 1 commit
  9. 13 Jan, 2021 1 commit
    • Martin Atkins's avatar
      main: initialize the terminal (if any) using internal/terminal · 15c0645b
      Martin Atkins authored
      We need to call into terminal.Init in early startup to make sure that we
      either have a suitable Terminal or that we disable attempts to use virtual
      terminal escape sequences.
      
      This commit gets the terminal initialized but doesn't do much with it
      after that. Subsequent commits will make more use of this.
      15c0645b
  10. 12 Jan, 2021 1 commit
    • Pam Selle's avatar
      Remove revision from version command · 83e6703b
      Pam Selle authored
      The revision field is only populated on dev builds so this means
      most releases of Terraform have an empty "terraform_revision" field
      in the JSON output. Since we recommend developers use go tooling
      to `go build` this tool when developing, the revision is not useful
      data and so it is removed.
      83e6703b
  11. 30 Nov, 2020 1 commit
    • James Bardin's avatar
      redirect warnigns to stdout · 0c3bb316
      James Bardin authored
      The default cli Warn calls always write to the error writer (stderr by
      default), however the output is intended to be viewed in the UI by the
      user, rather than in a separate stream. Terraform also generally does
      not consider warnings to be errors from the cli point of view, and does
      not need to output the warning text to stderr.
      
      By redirecting Warn calls to Output calls at the lowest level in the
      main package, we can eliminate the chance that Warn and Output
      messages are interleaved, while still allowing the internal `cli.Ui`
      implementations to format `Warn` and `Output` calls separately.
      0c3bb316
  12. 18 Nov, 2020 1 commit
    • Martin Atkins's avatar
      main: Special error message for invalid top-level command · 28d2cb55
      Martin Atkins authored
      Previously Terraform would react to an invalid top-level command the same
      way as for typing no command at all: just printing out the long top-level
      help directory.
      
      If someone's tried to type a command, it's more helpful to respond to that
      request by explaining directly that the command is invalid, rather than
      leaving the user to puzzle that out themselves by referring to the help
      text.
      
      As a bonus, this also allows us to use our "didyoumean" package to suggest
      possible alternatives if it seems like the user made a typo.
      28d2cb55
  13. 26 Oct, 2020 1 commit
    • James Bardin's avatar
      record all plugin panics, and print on main exit · 3225d9ac
      James Bardin authored
      Create a logger that will record any apparent crash output for later
      processing.
      
      If the cli command returns with a non-zero exit status, check for any
      recorded crashes and add those to the output.
      3225d9ac
  14. 23 Oct, 2020 1 commit
    • James Bardin's avatar
      separate core and provider loggers · f8893785
      James Bardin authored
      Now that hclog can independently set levels on related loggers, we can
      separate the log levels for different subsystems in terraform.
      
      This adds the new environment variables, `TF_LOG_CORE` and
      `TF_LOG_PROVIDER`, which each take the same set of log level arguments,
      and only applies to logs from that subsystem. This means that setting
      `TF_LOG_CORE=level` will not show logs from providers, and
      `TF_LOG_PROVIDER=level` will not show logs from core. The behavior of
      `TF_LOG` alone does not change.
      
      While it is not necessarily needed since the default is to disable logs,
      there is also a new level argument of `off`, which reflects the
      associated level in hclog.
      f8893785
  15. 21 Oct, 2020 3 commits
  16. 19 Oct, 2020 2 commits
  17. 16 Oct, 2020 1 commit
    • Martin Atkins's avatar
      command/cliconfig: Allow development overrides for providers · 30204ecd
      Martin Atkins authored
      For normal provider installation we want to associate each provider with
      a selected version number and find a suitable package for that version
      that conforms to the official hashes for that release.
      
      Those requirements are very onerous for a provider developer currently
      testing a not-yet-released build, though. To allow for that case this new
      CLI configuration feature allows overriding specific providers to refer
      to give local filesystem directories.
      
      Any provider overridden in this way is not subject to the usual
      restrictions about selected versions or checksum conformance, and
      activating an override won't cause any changes to the selections recorded
      in the lock file because it's intended to be a temporary setting for one
      developer only.
      
      This is, in a sense, a spiritual successor of an old capability we had to
      override specific plugins in the CLI configuration file. There were
      some vestiges of that left in the main package and CLI config packa...
      30204ecd
  18. 13 Oct, 2020 1 commit
  19. 04 Sep, 2020 1 commit
    • Martin Atkins's avatar
      main: new global option -chdir · efe78b29
      Martin Atkins authored
      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 hopeful...
      efe78b29
  20. 03 Jun, 2020 1 commit
    • Alisdair McDiarmid's avatar
      main: Pass untyped nil for missing creds source · f1f24df7
      Alisdair McDiarmid authored
      If we are unable to create a credentials source for some reason, we can
      rely on the disco object to nil-check it before calling any of its
      methods. However to do this we must ensure that we pass untyped nil.
      This commit rearranges the initialization to ensure that this happens.
      
      The user-facing bug that triggered this work is that running init when
      the HOME environment variable is unset would result in a panic on macOS.
      f1f24df7
  21. 27 May, 2020 1 commit
    • Paddy's avatar
      command: Unmanaged providers · 5127f1ef
      Paddy authored
      This adds supports for "unmanaged" providers, or providers with process
      lifecycles not controlled by Terraform. These providers are assumed to
      be started before Terraform is launched, and are assumed to shut
      themselves down after Terraform has finished running.
      
      To do this, we must update the go-plugin dependency to v1.3.0, which
      added support for the "test mode" plugin serving that powers all this.
      
      As a side-effect of not needing to manage the process lifecycle anymore,
      Terraform also no longer needs to worry about the provider's binary, as
      it won't be used for anything anymore. Because of this, we can disable
      the init behavior that concerns itself with downloading that provider's
      binary, checking its version, and otherwise managing the binary.
      
      This is all managed on a per-provider basis, so managed providers that
      Terraform downloads, starts, and stops can be used in the same commands
      as unmanaged providers. The TF_REATTACH_PROVIDERS environment variable
      is added, and is a JSON encoding of the provider's address to the
      information we need to connect to it.
      
      This change enables two benefits: first, delve and other debuggers can
      now be attached to provider server processes, and Terraform can connect.
      This allows for attaching debuggers to provider processes, which before
      was difficult to impossible. Second, it allows the SDK test framework to
      host the provider in the same process as the test driver, while running
      a production Terraform binary against the provider. This allows for Go's
      built-in race detector and test coverage tooling to work as expected in
      provider tests.
      
      Unmanaged providers are expected to work in the exact same way as
      managed providers, with one caveat: Terraform kills provider processes
      and restarts them once per graph walk, meaning multiple times during
      most Terraform CLI commands. As unmanaged providers can't be killed by
      Terraform, and have no visibility into graph walks, unmanaged providers
      are likely to have differences in how their global mutable state behaves
      when compared to managed providers. Namely, unmanaged providers are
      likely to retain global state when managed providers would have reset
      it. Developers relying on global state should be aware of this.
      5127f1ef
  22. 23 Apr, 2020 1 commit
  23. 21 Apr, 2020 1 commit
  24. 06 Apr, 2020 1 commit
    • Martin Atkins's avatar
      main: Consult local directories as potential mirrors of providers · 8c928e83
      Martin Atkins authored
      This restores some of the local search directories we used to include when
      searching for provider plugins in Terraform 0.12 and earlier. The
      directory structures we are expecting in these are different than before,
      so existing directory contents will not be compatible without
      restructuring, but we need to retain support for these local directories
      so that users can continue to sideload third-party provider plugins until
      the explicit, first-class provider mirrors configuration (in CLI config)
      is implemented, at which point users will be able to override these to
      whatever directories they want.
      
      This also includes some new search directories that are specific to the
      operating system where Terraform is running, following the documented
      layout conventions of that platform. In particular, this follows the
      XDG Base Directory specification on Unix systems, which has been a
      somewhat-common request to better support "sideloading" of packages via
      standard Linux distribution package managers and other similar mechanisms.
      While it isn't strictly necessary to add that now, it seems ideal to do
      all of the changes to our search directory layout at once so that our
      documentation about this can cleanly distinguish "0.12 and earlier" vs.
      "0.13 and later", rather than having to document a complex sequence of
      smaller changes.
      
      Because this behavior is a result of the integration of package main with
      package command, this behavior is verified using an e2etest rather than
      a unit test. That test, TestInitProvidersVendored, is also fixed here to
      create a suitable directory structure for the platform where the test is
      being run. This fixes TestInitProvidersVendored.
      8c928e83
  25. 24 Jan, 2020 1 commit
    • Martin Atkins's avatar
      command: Accept a "provider source" from the main package · e9d0822b
      Martin Atkins authored
      Following the same approach we use for other CLI-Config-able objects like
      the service discovery system, the main package is responsible for
      producing a suitable implementation of this interface which the command
      package can then use.
      
      When unit testing in the command package we can then substitute mocks as
      necessary, following the dependency inversion principle.
      e9d0822b
  26. 13 Jan, 2020 1 commit
  27. 11 Oct, 2019 1 commit
  28. 09 Sep, 2019 1 commit
  29. 23 Aug, 2019 1 commit
    • Martin Atkins's avatar
      main: Use the new cliconfig package credentials source · 22a2580e
      Martin Atkins authored
      This should not cause any change in behavior yet, but using this new
      implementation will allow the "terraform login" and "terraform logout"
      commands to store and forget credentials when they are implemented in
      subsequent commits.
      22a2580e
  30. 01 Aug, 2019 1 commit
    • Martin Atkins's avatar
      command/cliconfig: Factor out CLI config handling · e1590d0a
      Martin Atkins authored
      This is just a wholesale move of the CLI configuration types and functions
      from the main package into its own package, leaving behind some type
      aliases and wrappers for now to keep existing callers working.
      
      This commit alone doesn't really achieve anything, but in future commits
      we'll expand the functionality in this package.
      e1590d0a
  31. 05 Apr, 2019 1 commit
  32. 06 Nov, 2018 1 commit