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. 15 Apr, 2021 1 commit
    • Martin Atkins's avatar
      Prototype: "expandnull" function · 4c38d9c3
      Martin Atkins authored
      This is intended to complement the "defaults" function as part of the
      optional attributes experiment, to give module authors a way to concisely
      declare that they don't care to distinugish between null objects/tuples
      and objects/tuples _containing_ nulls, and that they don't care to
      distinguish between null collections and empty collections, and thus they
      can avoid needing to do conditional traversals and focus only on handling
      the leaf primitive-typed values as being null.
      
      This is just a prototype to see what this might look like and how it will
      interact with the "defaults" function. It's not yet ready to be merged
      because it lacks tests and documentation.
      4c38d9c3
  2. 14 Apr, 2021 4 commits
    • James Bardin's avatar
      Merge pull request #28329 from serejkus/dag/set-tiny-optimisations · 2cd1619c
      James Bardin authored
      tiny optimisations of dag.Set
      2cd1619c
    • Alisdair McDiarmid's avatar
      Merge pull request #28363 from hashicorp/alisdair/here-is-a-newline · 2c8c3875
      Alisdair McDiarmid authored
      command: Add a newline before confirming apply
      2c8c3875
    • Alisdair McDiarmid's avatar
      command: Add a newline before confirming apply · e4031eac
      Alisdair McDiarmid authored
      This blank line delineating the plan and the query was accidentally
      dropped as part of the views migration.
      e4031eac
    • Martin Atkins's avatar
      website: v0.15 upgrade guide for sensitive resource attributes (#28355) · 5f5432e8
      Martin Atkins authored
      
      * website: v0.15 upgrade guide for sensitive resource attributes
      
      Our earlier draft of this guide didn't include a section about the
      stabilization of the "provider_sensitive_attrs" language experiment. This
      new section aims to address the situation where a module might previously
      have been returning a sensitive value without having marked it as such,
      and thus that module will begin returning an error after upgrading to
      Terraform v0.15.
      
      As part of that, I also reviewed the existing documentation about these
      features and made some edits aiming to make these four different sections
      work well together if users refer to them all at once, as they are likely
      to do if they follow the new links from the upgrade guide. I aimed to
      retain all of the content we had before, but some of it is now in a new
      location.
      
      In particular, I moved the discussion about the v0.14 language experiment
      into the upgrade guide, because it seems like a topic only really relevant
      to those upgrading from an earlier version and not something folks need to
      know about if they are using Terraform for the first time in v0.15 or
      later.
      
      * minor fixups
      Co-authored-by: default avatarKristin Laemmert <mildwonkey@users.noreply.github.com>
      5f5432e8
  3. 12 Apr, 2021 3 commits
    • Martin Atkins's avatar
      lang/funcs: "one" function · 140c613a
      Martin Atkins authored
      In the Terraform language we typically use lists of zero or one values in
      some sense interchangably with single values that might be null, because
      various Terraform language constructs are designed to work with
      collections rather than with nullable values.
      
      In Terraform v0.12 we made the splat operator [*] have a "special power"
      of concisely converting from a possibly-null single value into a
      zero-or-one list as a way to make that common operation more concise.
      
      In a sense this "one" function is the opposite operation to that special
      power: it goes from a zero-or-one collection (list, set, or tuple) to a
      possibly-null single value.
      
      This is a concise alternative to the following clunky conditional
      expression, with the additional benefit that the following expression is
      also not viable for set values, and it also properly handles the case
      where there's unexpectedly more than one value:
      
          length(var.foo) != 0 ? var.foo[0] : null
      
      Instead, we can write:
      
          one(var.foo)
      
      As with the splat operator, this is a tricky tradeoff because it could be
      argued that it's not something that'd be immediately intuitive to someone
      unfamiliar with Terraform. However, I think that's justified given how
      often zero-or-one collections arise in typical Terraform configurations.
      Unlike the splat operator, it should at least be easier to search for its
      name and find its documentation the first time you see it in a
      configuration.
      
      My expectation that this will become a common pattern is also my
      justification for giving it a short, concise name. Arguably it could be
      better named something like "oneornull", but that's a pretty clunky name
      and I'm not convinced it really adds any clarity for someone who isn't
      already familiar with it.
      140c613a
    • Alisdair McDiarmid's avatar
      Merge pull request #28326 from hashicorp/alisdair/allow-nonsensitive-on-non-sensitive-values · 33e5d111
      Alisdair McDiarmid authored
      lang/funcs: Make nonsensitive more permissive
      33e5d111
    • Alisdair McDiarmid's avatar
      lang/funcs: Make nonsensitive more permissive · c1f71934
      Alisdair McDiarmid authored
      Calling the nonsensitive function with values which are not sensitive
      will result in an error. This restriction was added with the goal of
      preventing confusingly redundant use of this function.
      
      Unfortunately, this breaks when using nonsensitive to reveal the value of
      sensitive resource attributes. This is because the validate walk does
      not (and cannot) mark attributes as sensitive based on the schema,
      because the resource value itself is unknown.
      
      This commit therefore alters this restriction such that it permits
      nonsensitive unknown values, and adds a test case to cover this specific
      scenario.
      c1f71934
  4. 09 Apr, 2021 1 commit
  5. 08 Apr, 2021 2 commits
  6. 06 Apr, 2021 6 commits
  7. 05 Apr, 2021 3 commits
    • Víctor Felipe Godoy Hernández's avatar
      Fix yamldecode example from json to yaml (#28220) · a9487c76
      Víctor Felipe Godoy Hernández authored
      * Fix yamldecode example from json to yaml
      
      * inline yaml example
      a9487c76
    • Matthew Hooker's avatar
      bump go-getter to 1.5.2 (#28189) · 49c984ff
      Matthew Hooker authored
      49c984ff
    • Dennis Gursky's avatar
      Improve ModuleInstance String() performance (#28246) · 4e42d218
      Dennis Gursky authored
      * Optimize (m ModuleInstance) String()
      
      Optimize (m ModuleInstance) String() to preallocate the buffer and use strings.Builder instead of bytes.Buffer
      
      This leads to a common case only doing a single allocation as opposed to a few allocations which the bytes.Buffer is doing.
      
      * adding a benchmark test
      
      Result:
      
      ```
      $ go test -bench=String ./addrs -benchmem 
      BenchmarkStringShort-12         18271692                56.52 ns/op           16 B/op          1 allocs/op
      BenchmarkStringLong-12           8057071               158.5 ns/op            96 B/op          1 allocs/op
      PASS
      $ git checkout main addrs/module_instance.go
      $ go test -bench=String ./addrs -benchmem 
      BenchmarkStringShort-12          7690818               162.0 ns/op            80 B/op          2 allocs/op
      BenchmarkStringLong-12           2922117               414.1 ns/op           288 B/op          3 allocs/op
      ```
      
      * Update module_instance_test.go
      
      switch spaces to tabs
      4e42d218
  8. 01 Apr, 2021 5 commits
  9. 31 Mar, 2021 6 commits
  10. 30 Mar, 2021 8 commits
  11. 29 Mar, 2021 1 commit
    • Alisdair McDiarmid's avatar
      cli: Only rewrite provider locks file if changed · 786d9920
      Alisdair McDiarmid authored
      If the provider locks have not changed, there is no need to rewrite the
      locks file. Preventing this needless rewrite should allow Terraform to
      operate in a read-only directory, so long as the provider requirements
      don't change.
      786d9920