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. 31 Mar, 2021 1 commit
  2. 26 Jan, 2021 1 commit
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 21 Oct, 2020 3 commits
  10. 19 Oct, 2020 2 commits
  11. 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
  12. 13 Oct, 2020 1 commit
  13. 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
  14. 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
  15. 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...
      5127f1ef
  16. 23 Apr, 2020 1 commit
  17. 21 Apr, 2020 1 commit
  18. 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
  19. 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
  20. 13 Jan, 2020 1 commit
  21. 11 Oct, 2019 1 commit
  22. 09 Sep, 2019 1 commit
  23. 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
  24. 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
  25. 05 Apr, 2019 1 commit
  26. 06 Nov, 2018 1 commit
  27. 17 Oct, 2018 2 commits
    • Martin Atkins's avatar
      terraform: Ugly huge change to weave in new State and Plan types · a3403f27
      Martin Atkins authored
      Due to how often the state and plan types are referenced throughout
      Terraform, there isn't a great way to switch them out gradually. As a
      consequence, this huge commit gets us from the old world to a _compilable_
      new world, but still has a large number of known test failures due to
      key functionality being stubbed out.
      
      The stubs here are for anything that interacts with providers, since we
      now need to do the follow-up work to similarly replace the old
      terraform.ResourceProvider interface with its replacement in the new
      "providers" package. That work, along with work to fix the remaining
      failing tests, will follow in subsequent commits.
      
      The aim here was to replace all references to terraform.State and its
      downstream types with states.State, terraform.Plan with plans.Plan,
      state.State with statemgr.State, and switch to the new implementations of
      the state and plan file formats. However, due to the number of times those
      types are used, this also ended up affecting numerous other parts of core
      such as terraform.Hook, the backend.Backend interface, and most of the CLI
      commands.
      
      Just as with 5861dbf3 before, I apologize
      in advance to the person who inevitably just found this huge commit while
      spelunking through the commit history.
      a3403f27
    • Martin Atkins's avatar
      command/format: include source snippets in diagnostics · bd10b84a
      Martin Atkins authored
      If we get a diagnostic message that references a source range, and if the
      source code for the referenced file is available, we'll show a snippet of
      the source code with the source range highlighted.
      
      At the moment we have no cache of source code, so in practice this
      codepath can never be visited. Callers to format.Diagnostic will be
      gradually updated in subsequent commits.
      bd10b84a
  28. 03 Aug, 2018 2 commits
  29. 14 Nov, 2017 1 commit
    • Martin Atkins's avatar
      main: don't print the CLI config into the logs · 275ab4a7
      Martin Atkins authored
      Now that we're expecting "credentials" blocks in the config (with auth
      tokens for private module registries, etc) we should not print out the
      config contents into the log, or else people will probably end up
      accidentally disclosing their credentials when sharing debug output with
      us, or will be reluctant to share debug output.
      275ab4a7
  30. 02 Nov, 2017 1 commit
    • Martin Atkins's avatar
      provider/terraform: reorganize for merge into core · a3ced1a3
      Martin Atkins authored
      The "terraform" provider was previously split out into its own repository,
      but that turned out to be a mistake due to how tightly it depends on
      aspects of Terraform Core.
      
      Here we prepare to bring it back into the core repository by reorganizing
      the directory layout to conform with what's expected there.
      a3ced1a3
  31. 21 Oct, 2017 2 commits
    • Martin Atkins's avatar
      main: factor out CLI config loading into its own function · 11ba1d2a
      Martin Atkins authored
      Previously we handled all of the config sources directly within the main
      function. We're going to make CLI config loading more complex shortly, so
      having this encapsulated in its own function will avoid creating even more
      clutter inside the main function.
      
      Along the way here we also switch from using native Go "error" to using
      tfdiags.Diagnostics, so that we can potentially issue warnings here too
      in future, and so that we can return multiple errors.
      11ba1d2a
    • Martin Atkins's avatar
      main: validate credentials blocks in CLI config · a2c59c6e
      Martin Atkins authored
      We require that each "credentials" block has a valid hostname and that
      there be no more than one "credentials_helper" block.
      
      There are some more sophisticated validations we could do here, such as
      checking if the same host is declared more than once, but since this
      config handling will be rewritten to use HCL2 in the near future, and this
      sort of check is easier to do in the HCL2 API, we just check the basic
      stuff for now and plan to revisit later.
      a2c59c6e
  32. 29 Sep, 2017 2 commits
    • Martin Atkins's avatar
      main: allow enabling plugin caching via config file or environment · cb17a9a6
      Martin Atkins authored
      Either the environment variable TF_PLUGIN_CACHE_DIR or a setting in the
      CLI config file (~/.terraformrc on Unix) allow opting in to the plugin
      caching behavior.
      
      This is opt-in because for new users we don't want to pollute their system
      with extra directories they don't know about. By opting in to caching, the
      user is assuming the responsibility to occasionally prune the cache over
      time as older plugins become stale and unused.
      cb17a9a6
    • Martin Atkins's avatar
      main: make configuration available when initializing commands · 3f401f0c
      Martin Atkins authored
      This, in principle, allows us to make use of configuration information
      when we populate the Meta structure, though we won't actually make use
      of that until a subsequent commit.
      3f401f0c
  33. 26 Sep, 2017 1 commit
    • Martin Atkins's avatar
      main: enable basic subcommand autocomplete · 9b5ae914
      Martin Atkins authored
      The CLI package has automatic support for shell autocomplete (bash and
      zsh, at time of writing) for subcommands, so all we need to do here is
      just opt into it.
      
      Users can install this into their shells by running:
          terraform -install-autocomplete
      9b5ae914