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. 26 Aug, 2022 1 commit
    • Martin Atkins's avatar
      states/statefile: Serialize check results into state snapshots · 6de3b1bd
      Martin Atkins authored
      This allows us to retain check results from one run into the next, so that
      we can react to status changes between runs and potentially report e.g.
      that a previously-failing check has now been fixed, or that a
      previously-failing check is "still failing" so that an operator can get
      a hint as to whether a problem is something they've just introduced or if
      it was already an active problem before they made a change.
      6de3b1bd
  2. 25 Jul, 2022 1 commit
    • Brandon Croft's avatar
      fix: have `terraform output` adhere to authorization w/ cloud · c33c8b01
      Brandon Croft authored
      Normally, `terraform output` refreshes and reads the entire state in the command package before pulling output values out of it. This doesn't give Terraform Cloud the opportunity to apply the read state outputs org permission and instead applies the read state versions permission.
      
      I decided to expand the state manager interface to provide a separate GetRootOutputValues function in order to give the cloud backend a more nuanced opportunity to fetch just the outputs. This required moving state Refresh/Read code that was previously in the command into the shared backend state as well as the filesystem state packages.
      c33c8b01
  3. 21 Jul, 2022 1 commit
    • Martin Atkins's avatar
      states/remote: use t.Run in table-based tests · 69aa0a2b
      Martin Atkins authored
      These tests were originally written long before Go supported subtests
      explicitly, but now that we have t.Run we can avoid the prior problem
      that one test failing would mask all of the others that followed it.
      
      Now we'll always run all of them, potentially collecting more errors in
      a single run so we can have more context to debug with and potentially
      fix them all in a single step rather than one by one.
      69aa0a2b
  4. 17 May, 2021 1 commit
    • Martin Atkins's avatar
      Move states/ to internal/states/ · f40800b3
      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.
      f40800b3
  5. 10 Sep, 2020 1 commit
    • Pam Selle's avatar
      Fix bug for force push for backends besides the remote backend · 2c35869a
      Pam Selle authored
      In refactoring the force push code when implementing force push
      for the Terraform remote backend, a bug was introduced that
      meant that backends that don't implement the EnableForcePush
      method would still have their state validated. This commit
      fixes that, and adds test coverage such that there is a separate
      mockRemoteClient that has this method implemented.
      2c35869a
  6. 11 Aug, 2020 1 commit
    • Kristin Laemmert's avatar
      state: remove deprecated state package (#25490) · 6621501a
      Kristin Laemmert authored
      Most of the state package has been deprecated by the states package.
      This PR replaces all the references to the old state package that
      can be done simply - the low-hanging fruit.
      
      * states: move state.Locker to statemgr
      
      The state.Locker interface was a wrapper around a statemgr.Full, so
      moving this was relatively straightforward.
      
      * command: remove unnecessary use of state package for writing local terraform state files
      
      * move state.LocalState into terraform package
      
      state.LocalState is responsible for managing terraform.States, so it
      made sense (to me) to move it into the terraform package.
      
      * slight change of heart: move state.LocalState into clistate instead of
      terraform
      6621501a
  7. 06 May, 2020 1 commit
    • Lee Trout's avatar
      Add support for force pushing with the remote backend · cb0e20ca
      Lee Trout authored
      Both differing serials and lineage protections should be bypassed
      with the -force flag (in addition to resources).
      
      Compared to other backends we aren’t just shipping over the state
      bytes in a simple payload during the persistence phase of the push
      command and the force flag added to the Go TFE client needs to be
      specified at that time.
      
      To prevent changing every method signature of PersistState of the
      remote client I added an optional interface that provides a hook
      to flag the Client as operating in a force push context. Changing
      the method signature would be more explicit at the cost of not
      being used anywhere else currently or the optional interface pattern
      could be applied to the state itself so it could be upgraded to
      support PersistState(force bool) only when needed.
      
      Prior to this only the resources of the state were checked for
      changes not the lineage or the serial. To bring this in line with
      documented behavior noted above those attributes also have a “read”
      counterpart just like state has. These are now checked along with
      state to determine if the state as a whole is unchanged.
      
      Tests were altered to table driven test format and testing was
      expanded to include WriteStateForMigration and its interaction
      with a ClientForcePusher type.
      cb0e20ca
  8. 04 May, 2020 1 commit
  9. 20 Jun, 2019 2 commits
    • Martin Atkins's avatar
      state/remote: Don't persist snapshot for unchanged state · 85eda8a0
      Martin Atkins authored
      Previously we would write to the backend for every call to PersistState,
      even if nothing changed since the last write, but update the serial only
      if the state had changed.
      
      The Terraform Cloud & Enterprise state storage have a simple safety check
      that any future write with an already-used lineage and serial must be
      byte-for-byte identical. StatesMarshalEqual is intended to detect that,
      but it only actually detects changes the state itself, and not changes
      to the snapshot metadata.
      
      Because we write the current Terraform version into the snapshot metadata
      during serialization, we'd previously have an issue where if the first
      state write after upgrading Terraform to a new version happened to change
      nothing about the state content then we'd write a new snapshot that
      differed only by Terraform version, and Terraform Cloud/Enterprise would
      then reject it.
      
      The snapshot header is discarded immediately after decoding, so we can't
      use information from it when deciding whether to increment the serial.
      The next best thing is to skip sending no-op snapshot updates to the state
      client in the first place.
      
      These writes are unnecessary anyway, and state storage owners have asked
      us in the past to elide these to avoid generating noise in their version
      logs, so we'll also finally meet those requests as a nice side-effect of
      this change.
      
      We didn't previously have tests for the full flow of retrieving and then
      successively updating persisted state snapshots, so this includes a test
      which covers that logic and includes an assertion that a no-op update does
      not get written to the state client.
      85eda8a0
    • Martin Atkins's avatar
      state/remote: Switch to statemgr interfaces in test · 2124089e
      Martin Atkins authored
      These statemgr interfaces are the new names for the older interfaces in
      the "state" package. These types alias each other so it doesn't really
      matter which we use, but the "state" package is deprecated and we intend
      to eventually remove it, so this is a further step in that direction.
      2124089e
  10. 17 Oct, 2018 2 commits
  11. 25 May, 2017 1 commit
  12. 20 Feb, 2017 1 commit
  13. 15 Feb, 2017 1 commit
  14. 24 Feb, 2015 1 commit
  15. 23 Feb, 2015 2 commits