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. 25 Mar, 2020 19 commits
    • James Bardin's avatar
      add EvalContext.WithPath · 0b025d74
      James Bardin authored
      As the Graph is walked, the current way to set the context path was to
      have the walker return a context from EnterPath. This required that
      every node know it's absolute path, which can no longer be the case
      during plan when modules have not been expanded.
      
      This introduces a new method called WithPath, which returns a copy of
      the context with the internal path updated to reflect the method
      argument. Any use of the EvalContext that requires knowing the path will
      now panic if it wasn't explicitly set to ensure that evaluations always
      occur in the correct path.
      
      Add EvalContext to the GraphWalker interface.
      EvalContext returns an EvalContext that has not yet set a path. This
      will allow us to enforce that all context operations requiring a module
      instance path will require that a path be explicitly set rather than
      evaluating within the wrong path.
      0b025d74
    • Martin Atkins's avatar
      internal/providercache: LinkFromOtherCache removes target, not source · 537c1bed
      Martin Atkins authored
      This was incorrectly removing the _source_ entry prior to creating the
      symlink, therefore ending up with a dangling symlink and no source file.
      
      This wasn't obvious before because the test case for LinkFromOtherCache
      was also incorrectly named and therefore wasn't running. Fixing the name
      of that test made this problem apparent.
      
      The TestLinkFromOtherCache test case now ends up seeing the final resolved
      directory rather than the symlink target, because of upstream changes
      to the internal/getproviders filesystem scanning logic to handle symlinks
      properly.
      537c1bed
    • Martin Atkins's avatar
      internal/getproviders: SearchLocalDirectory can handle symlinks · eb25fe8b
      Martin Atkins authored
      Previously this was failing to treat symlinks to directories as unpacked
      layout, because our file info was only an Lstat result, not a full Stat.
      
      Now we'll resolve the symlink first, allowing us to handle a symlink to
      a directory. That's important because our internal/providercache behavior
      is to symlink from one cache to another where possible.
      eb25fe8b
    • Martin Atkins's avatar
      internal/{getproviders,providercache}: improved trace logging · ad154594
      Martin Atkins authored
      There's a lot going on in these functions that can be hard to follow from
      the outside, so we'll add some additional trace logging so that we can
      more easily understand why things are behaving the way they are.
      ad154594
    • Martin Atkins's avatar
      internal/providercache: add windows test fixture · 391ca0c9
      Martin Atkins authored
      This was accidentally left out of an earlier commit due to our top-level
      .gitignore file containing *.exe as an ignore pattern.
      391ca0c9
    • Pam Selle's avatar
      34de1453
    • James Bardin's avatar
      Merge pull request #24454 from hashicorp/jbardin/expand-resource · c7e2bace
      James Bardin authored
      Expander.ExpandResource cannot expand all modules
      c7e2bace
    • Martin Atkins's avatar
      internal/providercache: Installation from HTTP URLs and local archives · 807267d1
      Martin Atkins authored
      When a provider source produces an HTTP URL location we'll expect it to
      resolve to a zip file, which we'll first download to a temporary
      directory and then treat it like a local archive.
      
      When a provider source produces a local archive path we'll expect it to
      be a zip file and extract it into the target directory.
      
      This does not yet include an implementation of installing from an
      already-unpacked local directory. That will follow in a subsequent commit,
      likely following a similar principle as in Dir.LinkFromOtherCache.
      807267d1
    • Martin Atkins's avatar
      command: Expose providercache package objects for use elsewhere · 754b7ebb
      Martin Atkins authored
      These new functions allow command implementations to get hold of the
      providercache objects and installation source object derived from the
      current CLI configuration.
      754b7ebb
    • Martin Atkins's avatar
      internal/getproviders: Exit early if MultiSource has no sources · e4d7a71d
      Martin Atkins authored
      The MultiSource isn't actually properly implemented yet, but this is a
      minimal implementation just for the case where there are no underlying
      sources at all, because we use an empty MultiSource as a placeholder
      when a test in the "command" package fails to explicitly populate a
      ProviderSource.
      e4d7a71d
    • Martin Atkins's avatar
      internal/providercache: First pass of the actual install process · 18dd0a39
      Martin Atkins authored
      This is not tested yet, but it's a compilable strawman implementation of
      the necessary sequence of events to coordinate all of the moving parts
      of running a provider installation operation.
      
      This will inevitably see more iteration in later commits as we complete
      the surrounding parts and wire it up to be used by "terraform init". So
      far, it's just dead code not called by any other package.
      18dd0a39
    • Martin Atkins's avatar
      internal/providercache: Start to stub Installer type · 03155daf
      Martin Atkins authored
      The Installer type will encapsulate the logic for running an entire
      provider installation request: given a set of providers to install, it
      will determine a method to obtain each of them (or detect that they are
      already installed) and then take the necessary actions.
      
      So far it doesn't do anything, but this stubs out an interface by which
      the caller can request ongoing notifications during an installation
      operation.
      03155daf
    • Martin Atkins's avatar
      internal/providercache: Stub of Dir.InstallPackage method · e4d14324
      Martin Atkins authored
      This will eventually be responsible for actually retrieving a package from
      a source and then installing it into the cache directory, but for the
      moment it's just a stub to complete the proposed API, which I intend to
      test in a subsequent commit by writing the full "Installer" API that will
      encapsulate the full installation logic.
      e4d14324
    • Martin Atkins's avatar
      internal/providercache: Linking from one cache to another · 67ca0679
      Martin Atkins authored
      When a system-wide shared plugin cache is configured, we'll want to make
      use of entries already in the shared cache when populating a local
      (configuration-specific) cache.
      
      This new method LinkFromOtherCache encapsulates the work of placing a link
      from one cache to another. If possible it will create a symlink, therefore
      retaining a key advantage of configuring a shared plugin cache, but
      otherwise we'll do a deep copy of the package directory from one cache
      to the other.
      
      Our old provider installer would always skip trying to create symlinks on
      Windows because Go standard library support for os.Symlink on Windows
      was inconsistent in older versions. However, os.Symlink can now create
      symlinks using a new API introduced in a Windows 10 update and cleanly
      fail if symlink creation is impossible, so it's safe for us to just
      try to create the symlink and react if that produces an error, just as we
      used to do on non-Windows systems when possibly creating symlinks on
      filesystems that cannot support them.
      67ca0679
    • Martin Atkins's avatar
      internal/getproviders: Functions to determine installation directories · 514184cc
      Martin Atkins authored
      The existing functionality in this package deals with finding packages
      that are either available for installation or already installed. In order
      to support installation we also need to determine the location where a
      package should be installed.
      
      This lives in the getproviders package because that way all of the logic
      related to the filesystem layout for local provider directories lives
      together here where they can be maintained together more easily in future.
      514184cc
    • Martin Atkins's avatar
      internal/copydir: Factor out our recursive directory copy for reuse · 072c6d9a
      Martin Atkins authored
      We've previously been copying this function around so it could remain
      unexported while being used in various packages. However, it's a
      non-trivial function with lots of specific assumptions built into it, so
      here we'll put it somewhere that other packages can depend on it _and_
      document the assumptions it seems to be making for future reference.
      
      As a bonus, this now uses os.SameFile to detect when two paths point to
      the same physical file, instead of the slightly buggy local implementation
      we had before which only worked on Unix systems and did not correctly
      handle when the paths were on different physical devices.
      
      The copy of the function I extracted here is the one from internal/initwd,
      so this commit also includes the removal of that unexported version and
      updating the callers in that package to use at at this new location.
      072c6d9a
    • Martin Atkins's avatar
      providercache: A package to encapsulate management of provider cache dirs · d1300183
      Martin Atkins authored
      Historically our logic to handle discovering and installing providers has
      been spread across several different packages. This package is intended
      to become the home of all logic related to what is now called "provider
      cache directories", which means directories on local disk where Terraform
      caches providers in a form that is ready to run.
      
      That includes both logic related to interrogating items already in a cache
      (included in this commit) and logic related to inserting new items into
      the cache from upstream provider sources (to follow in later commits).
      
      These new codepaths are focused on providers and do not include other
      plugin types (provisioners and credentials helpers), because providers are
      the only plugin type that is represented by a heirarchical, decentralized
      namespace and the only plugin type that has an auto-installation protocol
      defined. The existing codepaths will remain to support the handling of
      the other plugin type...
      d1300183
    • Martin Atkins's avatar
      internal/getproviders: Make local directory search a public API · 283b4d4c
      Martin Atkins authored
      Previously this was available by instantiating a throwaway
      FilesystemMirrorSource, but that's pretty counter-intuitive for callers
      that just want to do a one-off scan without retaining any ongoing state.
      
      Now we expose SearchLocalDirectory as an exported function, and the
      FilesystemMirrorSource then uses it as part of its implementation too.
      Callers that just want to know what's available in a directory can call
      SearchLocalDirectory directly.
      283b4d4c
    • James Bardin's avatar
      Expander.ExpandResource cannot expand all modules · 14ec3e60
      James Bardin authored
      ExpandResource must only check the specific ModuleInstances in the
      requested path, because the resource may not have been registered yet in
      all module instances.
      14ec3e60
  2. 24 Mar, 2020 3 commits
    • James Bardin's avatar
      Merge pull request #24444 from hashicorp/jbardin/expand-resource · c49fd39c
      James Bardin authored
      Expander.ExpandResource should use AbsResource
      c49fd39c
    • James Bardin's avatar
      udpate core to work with new ExpandResource · 1b3f5bee
      James Bardin authored
      This also calls ExpandModuleResource in one location, because the logic
      is not yet updated to handle actual module expansion, but that will be
      fixed in a forthcoming PR.
      1b3f5bee
    • James Bardin's avatar
      Expander.ExpandResource · 0d58537b
      James Bardin authored
      It turns out that within terraform resource expansion will normally
      happen with an absolute address. This is because in order to evaluate
      the expansion expression, we need to already have the context within a
      module instance.
      
      This leaves the existing ExpandResource logic in place as
      ExpandModuleResource since it's working, and in case we do find a
      location where it's useful to get a full expansion (which may be needed
      for instance dependency tracking)
      
      Reword some of the resource related arguments and comments, as they were
      copied from the module methods and not entirely accurate.
      0d58537b
  3. 23 Mar, 2020 3 commits
  4. 20 Mar, 2020 2 commits
    • Kristin Laemmert's avatar
      rename provider-specific functions (#24417) · 4f141ae3
      Kristin Laemmert authored
      missingPlugins was hard-coded to work only with provider plugins, so I
      renamed it to clarify the usage.
      
      Also renamed a test provider from greater_than to greater-than as the
      underscore is an invalid provider name character and this will become a
      hard error in the near future.
      4f141ae3
    • Kristin Laemmert's avatar
      Mildwonkey/ps import (#24412) · c8d64846
      Kristin Laemmert authored
      * import: remove Config from ImportOpts
      
      `Config` in ImportOpts was any provider configuration provided by the
      user on the command line. This option has already been removed in favor
      of only taking the provider from the configuration loaded in the current
      context.
      
      * terrafrom: add Config to ImportStateTransformer and refactor Transform
      to get the resource provider FQN from the Config
      c8d64846
  5. 19 Mar, 2020 5 commits
  6. 18 Mar, 2020 5 commits
  7. 17 Mar, 2020 3 commits