Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added flatten interpolation function #15278

Merged
merged 109 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
822a98a
Fix swallowed tests in terraform package tests
alrs Jul 20, 2017
7584ac1
update consul vendor
jbardin Jul 17, 2017
1070d04
Remove consul context adapter for RenewPeriodic
jbardin Jul 17, 2017
45a9edb
make state mv and rm work with remote states
jbardin Jul 25, 2017
33ba677
Make the state commands use the real command.Meta
jbardin Jul 26, 2017
2e7c8ab
update commands.go to use StateMeta
jbardin Jul 27, 2017
5b4ae36
don't print help for state loading errors
jbardin Jul 27, 2017
51547ad
add tests for state commands through a backend
jbardin Jul 27, 2017
ca68723
memoize DiffFieldReader.ReadField
jbardin Jul 28, 2017
ac60ddc
Support named states in inmeme backend
jbardin Aug 1, 2017
5deef96
export Reset()
jbardin Aug 1, 2017
18d71f2
make inmem behave more like remote backends
jbardin Aug 1, 2017
16e8e40
create failing test cases for remote lineage issue
jbardin Aug 1, 2017
c3e943b
add another failing test for remote.State lineage
jbardin Aug 1, 2017
32ae05c
fix strict remote.State lineage check
jbardin Aug 1, 2017
07b0101
update workspace new test for inmem backend
jbardin Aug 1, 2017
270bbdb
core: Add `GetOkRaw` schema function
grubernaut Aug 2, 2017
67ceb1a
config: Make 'id' a reserved field name
radeksimko Aug 2, 2017
29b77ca
Update travis to go1.8.3 and add testing for go1.9rc1
cblecker Aug 2, 2017
473d08d
Update Vagrantfile to go1.8.3
cblecker Aug 2, 2017
3db869b
update dockerfile to not include version prerelease string
grubernaut Aug 2, 2017
ed5bbac
Merge pull request #15702 from hashicorp/f-update-dockerfile
grubernaut Aug 2, 2017
8c7bfde
Docs: Fix broken links and a broken example
nfagerlund Aug 3, 2017
fb50afb
Merge pull request #15708 from nfagerlund/aug2017_consul_example_link
radeksimko Aug 3, 2017
de3015c
Remove overly verbose DEBUG log
radeksimko Aug 3, 2017
6339f95
Merge pull request #15722 from hashicorp/b-remove-verbose-debug-log
radeksimko Aug 3, 2017
268138d
Rename to GetOkExists
grubernaut Aug 3, 2017
dc30761
Merge pull request #15567 from hashicorp/jbardin/consul-update
jbardin Aug 3, 2017
55d18dc
update state rm amd mv docs
jbardin Jul 27, 2017
8a8b431
Merge pull request #15663 from hashicorp/jbardin/diff-field-reader
jbardin Aug 3, 2017
eadda50
Merge pull request #15652 from hashicorp/jbardin/state-command
jbardin Aug 3, 2017
fa272e8
Add more specific exists tests
grubernaut Aug 3, 2017
e76049e
update CHANGELOG.md
jbardin Aug 3, 2017
d969f97
update tests
grubernaut Aug 3, 2017
3600f0b
Merge pull request #15723 from hashicorp/f-get-boolean-non-default
grubernaut Aug 3, 2017
66971ce
Update CHANGELOG.md
grubernaut Aug 3, 2017
11668d5
Merge pull request #15599 from alrs/terraform-tests-swallowed-errors
jbardin Aug 4, 2017
550197d
Merge pull request #15698 from cblecker/go1.8.3
jbardin Aug 4, 2017
4acdc53
Merge pull request #15695 from radeksimko/f-config-reserve-id
radeksimko Aug 4, 2017
3db3502
Update CHANGELOG.md
radeksimko Aug 4, 2017
05ce582
vendor: rm github.com/armon/go-metrics
josephholsten Aug 4, 2017
eccfa6d
vendor: rm github.com/hashicorp/go-msgpack/codec
josephholsten Aug 4, 2017
153202c
vendor: rm github.com/hashicorp/golang-lru(/simplelru)
josephholsten Aug 4, 2017
b413061
Document how to provide provider plugin overrides
ctavan Aug 7, 2017
59c9ca5
Merge pull request #15737 from josephholsten/clean-vendor
radeksimko Aug 7, 2017
40bb761
small typo correction
kbrowns Aug 7, 2017
50108d3
Merge pull request #15748 from kbrowns/patch-1
catsby Aug 7, 2017
944a930
Fix typo of additional
gregswift Aug 7, 2017
77f74c3
Merge pull request #15749 from gregswift/typo-additional
catsby Aug 7, 2017
3998560
Merge pull request #15745 from ctavan/improve-provider-plugin-docs
catsby Aug 7, 2017
2597500
reword init documentation for consistency
jbardin Aug 7, 2017
a56a97a
mention 'terraform.d/plugins` for automation
jbardin Aug 7, 2017
5624002
Merge pull request #15755 from hashicorp/jbardin/init-docs
jbardin Aug 8, 2017
4c7cd54
don't allow leading slashes in s3 remote state key
jbardin Aug 4, 2017
5769ee7
Merge pull request #15738 from hashicorp/jbardin/s3-key-validation
jbardin Aug 8, 2017
5f3e762
Fix titles on partner contact table on provider development program g…
alex1x Aug 8, 2017
8b3b678
Merge pull request #15760 from alex1x/master
catsby Aug 8, 2017
e374890
Don't ForceLocal for the import backend
jbardin Aug 8, 2017
41ab0ae
Add missing OS_ARCH dir to global plugin paths
jbardin Aug 9, 2017
fa20d43
test loading of Meta.PluginOverrides
jbardin Aug 9, 2017
5499893
load Meta.PluginOverrides in dicovery
jbardin Aug 9, 2017
4034f98
update import command docs
jbardin Aug 9, 2017
37932c3
make state_rm flag description match state_mv
jbardin Aug 9, 2017
db42015
backoff retries in remote-exec provisioner
jbardin Aug 9, 2017
52dbf94
keep .terraform.d/plugins for discovery
jbardin Aug 9, 2017
2bb5007
Merge pull request #15683 from hashicorp/jbardin/remote-state-lineage
jbardin Aug 9, 2017
a87161b
Merge pull request #15772 from hashicorp/jbardin/remote-exec-backoff
jbardin Aug 9, 2017
5bcc1ba
Merge pull request #15769 from hashicorp/jbardin/discovery-paths
jbardin Aug 9, 2017
f291994
Guides: remove the provider development program for now
catsby Aug 10, 2017
48acba2
Merge pull request #15775 from hashicorp/dev-program-remove
catsby Aug 10, 2017
97bb7cb
Don't allow interpolation failure to stop Input
jbardin Jul 21, 2017
1664d4e
test with bad interpolation during Input
jbardin Aug 10, 2017
4bc88d2
website: correct the spelling of the -from-module arg to "terraform i…
apparentlymart Aug 11, 2017
ea3e87b
Merge pull request #15768 from hashicorp/jbardin/remote-import
jbardin Aug 11, 2017
d756e59
Merge pull request #15780 from hashicorp/jbardin/input-module-vars
jbardin Aug 11, 2017
ee5fc3b
govendor fetch github.com/hashicorp/go-plugin/...
apparentlymart Aug 11, 2017
93613ee
terraform+dag: Set lower log levels
radeksimko Aug 14, 2017
eb20352
Merge pull request #15800 from hashicorp/lower-log-lvl-dag
radeksimko Aug 14, 2017
655f1d6
vendor: Bump github.com/mitchellh/cli to latest
radeksimko Aug 14, 2017
38cb98f
Comply w/ latest changes in mitchellh/cli
radeksimko Aug 14, 2017
b1e925e
Merge pull request #15802 from hashicorp/vendor-bump-mitchellh-cli
radeksimko Aug 14, 2017
5c8ff92
build: scripted local build process for docker images
apparentlymart Jul 29, 2017
81f9c78
Adding `resource_group_name` back in, fixes #15610 (#15809)
tombuildsstuff Aug 15, 2017
e9ffa24
Fix a typo in CHANGELOG.md
rkhozinov Aug 15, 2017
9595265
Merge pull request #15812 from rkhozinov/patch-1
grubernaut Aug 15, 2017
28b33c9
plugin: Display version + source when initializing plugins
radeksimko Aug 14, 2017
82c6caa
Merge pull request #15804 from hashicorp/plugin-transparency
radeksimko Aug 15, 2017
faee1c3
Update CHANGELOG.md
radeksimko Aug 15, 2017
714df97
specify a logger for go-plugin
jbardin Aug 15, 2017
3dd0f93
Merge pull request #15816 from hashicorp/jbardin/plugin-logger
jbardin Aug 15, 2017
ecdc964
update CHANGELOG.md
jbardin Aug 15, 2017
f6d1626
v0.10.1
jbardin Aug 15, 2017
bb00fd4
release: clean up after v0.10.1
jbardin Aug 15, 2017
ca42980
helper/schema: Add Set.HashEqual
vancluever Aug 16, 2017
287a5eb
helper/schema: More tests for Set.HashEqual
vancluever Aug 16, 2017
181c5e0
update go-plugin
jbardin Aug 16, 2017
f4c648f
tools/terraform-bundle: Add missing Ui to ProviderInstaller (fix crash)
radeksimko Aug 16, 2017
bcd692a
tools/terraform-bundle: Refactor & simplify messages
radeksimko Aug 16, 2017
1ae7b41
Merge pull request #15826 from hashicorp/tf-bundle-fix-crash
radeksimko Aug 16, 2017
355c00b
Merge pull request #15825 from hashicorp/jbardin/go-plugin
jbardin Aug 16, 2017
698d888
Update CHANGELOG.md
radeksimko Aug 16, 2017
6ecf535
Merge pull request #15819 from hashicorp/f-schema-set-hashequal
vancluever Aug 16, 2017
9817110
update CHANGELOG.md
jbardin Aug 16, 2017
a1d06eb
v0.10.2
jbardin Aug 16, 2017
08339b0
release: clean up after v0.10.2
jbardin Aug 16, 2017
db6ef69
fix race in MockResourceProvider
jbardin Aug 16, 2017
bf97909
core: document all of the fields on the Plan struct
apparentlymart Aug 16, 2017
f1042a1
Merge pull request #15835 from hashicorp/jbardin/mock-provider-race
jbardin Aug 16, 2017
117f44b
config: Add "flatten" interpolation function
Jun 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ dist: trusty
sudo: false
language: go
go:
- 1.8.1
- 1.8.3
- 1.9rc1

# add TF_CONSUL_TEST=1 to run consul tests
# they were causing timouts in travis
Expand Down
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
## 0.10.1 (Unreleased)
## 0.10.3 (Unreleased)

## 0.10.2 (August 16, 2017)

BUG FIXES:

* tools/terraform-bundle: Add missing Ui to ProviderInstaller (fix crash) ([#15826](https://github.com/hashicorp/terraform/issues/15826))
* go-plugin: crash when server emits non-key-value JSON ([go-plugin#43](https://github.com/hashicorp/go-plugin/pull/43))

## 0.10.1 (August 15, 2017)

BUG FIXES:

* Fix `terraform state rm` and `mv` commands to work correctly with remote state backends ([#15652](https://github.com/hashicorp/terraform/issues/15652))
* Fix errors when interpolations fail during input ([#15780](https://github.com/hashicorp/terraform/issues/15780))
* Backoff retries in remote-execution provisioner ([#15772](https://github.com/hashicorp/terraform/issues/15772))
* Load plugins from `~/.terraform.d/plugins/OS_ARCH/` and `.terraformrc` ([#15769](https://github.com/hashicorp/terraform/issues/15769))
* The `import` command was ignoring the remote state configuration ([#15768](https://github.com/hashicorp/terraform/issues/15768))
* Don't allow leading slashes in s3 bucket names for remote state ([#15738](https://github.com/hashicorp/terraform/issues/15738))

IMPROVEMENTS:

* helper/schema: Add `GetOkExists` schema function ([#15723](https://github.com/hashicorp/terraform/issues/15723))
* helper/schema: Make 'id' a reserved field name ([#15695](https://github.com/hashicorp/terraform/issues/15695))
* command/init: Display version + source when initializing plugins ([#15804](https://github.com/hashicorp/terraform/issues/15804))

INTERNAL CHANGES:

* DiffFieldReader.ReadField caches results to optimize deeply nested schemas ([#15663](https://github.com/hashicorp/terraform/issues/15663))


## 0.10.0 (August 2, 2017)

Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ MAINTAINER "HashiCorp Terraform Team <terraform@hashicorp.com>"
RUN apk add --update git bash openssh

ENV TF_DEV=true
ENV TF_RELEASE=1

WORKDIR $GOPATH/src/github.com/hashicorp/terraform
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
VAGRANTFILE_API_VERSION = "2"

# Software version variables
GOVERSION = "1.8.1"
GOVERSION = "1.8.3"
UBUNTUVERSION = "16.04"

# CPU and RAM can be adjusted depending on your system
Expand Down
2 changes: 1 addition & 1 deletion backend/remote-state/consul/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func newConsulTestServer(t *testing.T) *testutil.TestServer {
t.Skip()
}

srv := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
srv, _ := testutil.NewTestServerConfigT(t, func(c *testutil.TestServerConfig) {
c.LogLevel = "warn"

if !testing.Verbose() {
Expand Down
9 changes: 1 addition & 8 deletions backend/remote-state/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,7 @@ func (c *RemoteClient) createSession() (string, error) {
log.Println("[INFO] created consul lock session", id)

// keep the session renewed
// we need an adapter to convert the session Done() channel to a
// non-directional channel to satisfy the RenewPeriodic signature.
done := make(chan struct{})
go func() {
<-ctx.Done()
close(done)
}()
go session.RenewPeriodic(lockSessionTTL, id, nil, done)
go session.RenewPeriodic(lockSessionTTL, id, nil, ctx.Done())

return id, nil
}
Expand Down
197 changes: 182 additions & 15 deletions backend/remote-state/inmem/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,207 @@ package inmem

import (
"context"
"errors"
"fmt"
"sort"
"sync"
"time"

"github.com/hashicorp/terraform/backend"
"github.com/hashicorp/terraform/backend/remote-state"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/state"
"github.com/hashicorp/terraform/state/remote"
"github.com/hashicorp/terraform/terraform"
)

// we keep the states and locks in package-level variables, so that they can be
// accessed from multiple instances of the backend. This better emulates
// backend instances accessing a single remote data store.
var (
states stateMap
locks lockMap
)

func init() {
Reset()
}

// Reset clears out all existing state and lock data.
// This is used to initialize the package during init, as well as between
// tests.
func Reset() {
states = stateMap{
m: map[string]*remote.State{},
}

locks = lockMap{
m: map[string]*state.LockInfo{},
}
}

// New creates a new backend for Inmem remote state.
func New() backend.Backend {
return &remotestate.Backend{
ConfigureFunc: configure,

// Set the schema
Backend: &schema.Backend{
Schema: map[string]*schema.Schema{
"lock_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "initializes the state in a locked configuration",
},
// Set the schema
s := &schema.Backend{
Schema: map[string]*schema.Schema{
"lock_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "initializes the state in a locked configuration",
},
},
}
backend := &Backend{Backend: s}
backend.Backend.ConfigureFunc = backend.configure
return backend
}

type Backend struct {
*schema.Backend
}

func configure(ctx context.Context) (remote.Client, error) {
func (b *Backend) configure(ctx context.Context) error {
states.Lock()
defer states.Unlock()

defaultClient := &RemoteClient{
Name: backend.DefaultStateName,
}

states.m[backend.DefaultStateName] = &remote.State{
Client: defaultClient,
}

// set the default client lock info per the test config
data := schema.FromContextBackendConfig(ctx)
if v, ok := data.GetOk("lock_id"); ok && v.(string) != "" {
info := state.NewLockInfo()
info.ID = v.(string)
info.Operation = "test"
info.Info = "test config"
return &RemoteClient{LockInfo: info}, nil

locks.lock(backend.DefaultStateName, info)
}

return nil
}

func (b *Backend) States() ([]string, error) {
states.Lock()
defer states.Unlock()

var workspaces []string

for s := range states.m {
workspaces = append(workspaces, s)
}

sort.Strings(workspaces)
return workspaces, nil
}

func (b *Backend) DeleteState(name string) error {
states.Lock()
defer states.Unlock()

if name == backend.DefaultStateName || name == "" {
return fmt.Errorf("can't delete default state")
}

delete(states.m, name)
return nil
}

func (b *Backend) State(name string) (state.State, error) {
states.Lock()
defer states.Unlock()

s := states.m[name]
if s == nil {
s = &remote.State{
Client: &RemoteClient{
Name: name,
},
}
states.m[name] = s

// to most closely replicate other implementations, we are going to
// take a lock and create a new state if it doesn't exist.
lockInfo := state.NewLockInfo()
lockInfo.Operation = "init"
lockID, err := s.Lock(lockInfo)
if err != nil {
return nil, fmt.Errorf("failed to lock inmem state: %s", err)
}
defer s.Unlock(lockID)

// If we have no state, we have to create an empty state
if v := s.State(); v == nil {
if err := s.WriteState(terraform.NewState()); err != nil {
return nil, err
}
if err := s.PersistState(); err != nil {
return nil, err
}
}
}
return &RemoteClient{}, nil

return s, nil
}

type stateMap struct {
sync.Mutex
m map[string]*remote.State
}

// Global level locks for inmem backends.
type lockMap struct {
sync.Mutex
m map[string]*state.LockInfo
}

func (l *lockMap) lock(name string, info *state.LockInfo) (string, error) {
l.Lock()
defer l.Unlock()

lockInfo := l.m[name]
if lockInfo != nil {
lockErr := &state.LockError{
Info: lockInfo,
}

lockErr.Err = errors.New("state locked")
// make a copy of the lock info to avoid any testing shenanigans
*lockErr.Info = *lockInfo
return "", lockErr
}

info.Created = time.Now().UTC()
l.m[name] = info

return info.ID, nil
}

func (l *lockMap) unlock(name, id string) error {
l.Lock()
defer l.Unlock()

lockInfo := l.m[name]

if lockInfo == nil {
return errors.New("state not locked")
}

lockErr := &state.LockError{
Info: &state.LockInfo{},
}

if id != lockInfo.ID {
lockErr.Err = errors.New("invalid lock id")
*lockErr.Info = *lockInfo
return lockErr
}

delete(l.m, name)
return nil
}
Loading