Commit Graph

16671 Commits

Author SHA1 Message Date
Mitchell Hashimoto bdde7d845a Merge pull request #12347 from hashicorp/b-env-migrate
command: migrating envs when changing backends
2017-03-01 12:58:40 -08:00
Mitchell Hashimoto 4f680aa5b8
update CHANGELOG 2017-03-01 12:41:37 -08:00
Mitchell Hashimoto 549d525487 Merge pull request #12320 from hashicorp/b-legacy-state
command: fix loading legacy remote state + migration guide
2017-03-01 12:39:17 -08:00
Mitchell Hashimoto 1e3d452613
command: multistate to multistate conversions 2017-03-01 12:35:59 -08:00
James Bardin 87dfe06598 Merge pull request #12345 from hashicorp/jbardin/GH-12145
make flatmap.Expand understand computed sets
2017-03-01 14:54:50 -05:00
Mitchell Hashimoto c82d7dd56c
command: multi-state (non-default env) to single state 2017-03-01 11:40:28 -08:00
Mitchell Hashimoto e75b666591
command: test multi-state to single state 2017-03-01 11:34:45 -08:00
Mitchell Hashimoto 3ef82e6b5f
command: test multi-state with default only to single state 2017-03-01 11:08:39 -08:00
Mitchell Hashimoto 1d8b76c89d
command: initial work on migrating envs, basic cases first 2017-03-01 10:59:17 -08:00
James Bardin 057941ce18 make flatmap.Expand understand computed sets
For historical reasons, sets are represented as sparse lists in a
flatmap, however a computed set does not have a numeric index.

Strip the `~` flag from a computed set's index during expansion, and add
it back in the prefix after sorting.
2017-03-01 13:28:02 -05:00
Seth Vargo 9107ae4e93
Re-enable soft purging, stale-if-error 2017-03-01 12:38:09 -05:00
Paul Stack 177400dbbf provider/aws: Implement IPV6 Support for ec2 / VPC (#10538)
* provider/aws: Add support for IPV6 enabled VPC

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSVpc'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/12/09 14:07:31 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSVpc -timeout 120m
=== RUN   TestAccAWSVpc_importBasic
--- PASS: TestAccAWSVpc_importBasic (43.03s)
=== RUN   TestAccAWSVpc_basic
--- PASS: TestAccAWSVpc_basic (36.32s)
=== RUN   TestAccAWSVpc_enableIpv6
--- PASS: TestAccAWSVpc_enableIpv6 (29.37s)
=== RUN   TestAccAWSVpc_dedicatedTenancy
--- PASS: TestAccAWSVpc_dedicatedTenancy (36.63s)
=== RUN   TestAccAWSVpc_tags
--- PASS: TestAccAWSVpc_tags (67.54s)
=== RUN   TestAccAWSVpc_update
--- PASS: TestAccAWSVpc_update (66.16s)
=== RUN   TestAccAWSVpc_bothDnsOptionsSet
--- PASS: TestAccAWSVpc_bothDnsOptionsSet (16.82s)
=== RUN   TestAccAWSVpc_DisabledDnsSupport
--- PASS: TestAccAWSVpc_DisabledDnsSupport (36.52s)
=== RUN   TestAccAWSVpc_classiclinkOptionSet
--- PASS: TestAccAWSVpc_classiclinkOptionSet (38.13s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	739.543s
```

* provider/aws: New Resource: aws_egress_only_internet_gateway

```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEgressOnlyInternetGateway_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/12/09 14:22:16 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSEgressOnlyInternetGateway_ -timeout 120m
=== RUN   TestAccAWSEgressOnlyInternetGateway_basic
--- PASS: TestAccAWSEgressOnlyInternetGateway_basic (32.67s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	32.692s
```

* provider/aws: Add IPV6 support to aws_subnet

```
% make testacc TEST=./builtin/providers/aws
% TESTARGS='-run=TestAccAWSSubnet_'
% 1 ↵ ✹ ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/27 19:08:34 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSubnet_
-timeout 120m
=== RUN   TestAccAWSSubnet_importBasic
--- PASS: TestAccAWSSubnet_importBasic (69.88s)
=== RUN   TestAccAWSSubnet_basic
--- PASS: TestAccAWSSubnet_basic (51.28s)
=== RUN   TestAccAWSSubnet_ipv6
--- PASS: TestAccAWSSubnet_ipv6 (90.39s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws211.574s
```

* provider/aws: Add support for running aws_instances with ipv6 addresses
2017-03-01 16:16:59 +00:00
Paul Stack 3d198295f2 provider/aws: No longer ForceNew resource on lambda_function runtime (#12329)
update

Fixes: #12181

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSLambdaFunction_updateRuntime'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/01 11:20:18 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSLambdaFunction_updateRuntime -timeout 120m
=== RUN   TestAccAWSLambdaFunction_updateRuntime
--- PASS: TestAccAWSLambdaFunction_updateRuntime (110.25s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	110.279s
```
2017-03-01 15:30:39 +00:00
James Bardin f9aa3d3a0b Merge pull request #12182 from hashicorp/jbardin/environments
Environments
2017-03-01 10:30:03 -05:00
James Bardin 39a5ddd381 Split Meta back out of StateMeta
Removing the call to StateMeta.Env, so that it doesn't need an embedded
Meta field. Embed Meta and StateMeta separately in all State commands.
2017-03-01 10:20:32 -05:00
Dana Hoffman 75eb9209b7 provider/google: fix url map test and update logic (#12317) 2017-03-01 09:47:12 +00:00
Hyuntak Joo 5efc86e995 Add auto_upgrade_minor_version documentation (#12321) 2017-03-01 09:45:33 +00:00
Radek Simko 914e86d087 vendor: k8s.io/kubernetes/pkg/api/validation@v1.5.3 (#12267) 2017-03-01 09:30:02 +00:00
Mitchell Hashimoto 2c19aa69d9
command: legacy remote state should load from backendinit 2017-02-28 19:29:19 -08:00
Mitchell Hashimoto 6ea0dc0964
backend/consul: make address have a default to prevent input 2017-02-28 19:29:05 -08:00
Mitchell Hashimoto 8e44162fcb
website: backend upgrade guide 2017-02-28 19:19:57 -08:00
James Bardin 4dac986a91 Local.StatePaths doesn't need to reutrn an error
add a test to ensure we have consistent output
2017-02-28 19:18:16 -05:00
Paul Stack cf3d234f5c provider/aws: Refresh aws_autoscaling_schedule from state when autoscaling_group (#12312)
not found

Fixes: #12279

When manually deleting an autoscaling_group from the console, a
terraform plan would look as follows:

```
% terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837)
aws_autoscaling_group.foobar: Refreshing state... (ID: test)
aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar)
Error refreshing state: 1 error(s) occurred:

* aws_autoscaling_schedule.foobar: aws_autoscaling_schedule.foobar: Error retrieving Autoscaling Scheduled Actions: ValidationError: Group test not found
	status code: 400, request id: 093e9ed5-fe01-11e6-b990-1f64334b3a10

```

After this patch:

```
% terraform plan                                                                                                                          ✹ ✭
[WARN] /Users/stacko/Code/go/bin/terraform-provider-aws overrides an internal plugin for aws-provider.
  If you did not expect to see this message you will need to remove the old plugin.
  See https://www.terraform.io/docs/internals/internal-plugins.html
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_launch_configuration.foobar: Refreshing state... (ID: test-0096cf26c7eebdc9fcb5bd1837)
aws_autoscaling_group.foobar: Refreshing state... (ID: test)
aws_autoscaling_schedule.foobar: Refreshing state... (ID: foobar)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

+ aws_autoscaling_group.foobar
    arn:                               "<computed>"
    availability_zones.#:              "1"
    availability_zones.2487133097:     "us-west-2a"
    default_cooldown:                  "<computed>"
    desired_capacity:                  "<computed>"
    force_delete:                      "true"
    health_check_grace_period:         "300"
    health_check_type:                 "ELB"
    launch_configuration:              "test-0096cf26c7eebdc9fcb5bd1837"
    load_balancers.#:                  "<computed>"
    max_size:                          "1"
    metrics_granularity:               "1Minute"
    min_size:                          "1"
    name:                              "test"
    protect_from_scale_in:             "false"
    tag.#:                             "1"
    tag.157008572.key:                 "Foo"
    tag.157008572.propagate_at_launch: "true"
    tag.157008572.value:               "foo-bar"
    termination_policies.#:            "1"
    termination_policies.0:            "OldestInstance"
    vpc_zone_identifier.#:             "<computed>"
    wait_for_capacity_timeout:         "10m"

+ aws_autoscaling_schedule.foobar
    arn:                    "<computed>"
    autoscaling_group_name: "test"
    desired_capacity:       "0"
    end_time:               "2017-12-12T06:00:00Z"
    max_size:               "1"
    min_size:               "0"
    recurrence:             "<computed>"
    scheduled_action_name:  "foobar"
    start_time:             "2017-12-11T18:00:00Z"

Plan: 2 to add, 0 to change, 0 to destroy.
```
2017-02-28 22:08:22 +00:00
James Bardin dc675540de fix rebased tests 2017-02-28 16:35:46 -05:00
James Bardin 6c3800d17f update the remote state datasource
Add an `environment` field to the terraform remote state data source.
2017-02-28 16:35:46 -05:00
James Bardin b53704ed87 Thread the environment through all commands
Add Env and SetEnv methods to command.Meta to retrieve the current
environment name inside any command.

Make sure all calls to Backend.State contain an environment name, and
make the package compile against the update backend package.
2017-02-28 16:35:46 -05:00
James Bardin f866bb545c update remote-state/consul 2017-02-28 16:35:46 -05:00
James Bardin 597eb6c918 update remote-state/inmem client 2017-02-28 16:35:45 -05:00
James Bardin 8fdf3a42b8 update remote-state.Backend 2017-02-28 16:35:45 -05:00
James Bardin 5762878eba Make backcend/legacy match new Backend iface
move the unsupported error value to backend.ErrNamedStatesNotSupported
to be used by any backend implementation.
2017-02-28 16:35:45 -05:00
Viktor Voltaire 2a34bfa23e Changed function_name reference (#12193) 2017-02-28 21:31:33 +00:00
James Bardin 65527f35a4 update local.Local to match the latest Backend
Update the methods, remove the handling of "current", and make tests
pass.
2017-02-28 16:07:31 -05:00
James Bardin 96194fbc0d Update Backend interface to latest iteration
What will hopfully be the final version of the Backend interface. This
combines the MultiState interface into Backend since it will be required
to implement, and simplifies the interface because the Backend is no
longer responsible for tracking the current state.
2017-02-28 16:07:07 -05:00
James Bardin 7f453f3341 remove some leftover methods in the legacy backend
These were left from the initial implementation, but are not used.
2017-02-28 16:07:07 -05:00
James Bardin 2a73331c62 use State.HasResources rather than State.Empty
Destroying a terraform state can't always create an empty state, as
outputs and the root module may remain. Use HasResources to warn about
deleting an environment with resources.
2017-02-28 16:07:07 -05:00
James Bardin fbc11c7961 fix incorrect current state in local backend
Forgot to remove the currentState field, which was not always set. The
current state should always just be read from the environment file.

Always return the default state name when we can't determine the state.
2017-02-28 16:07:07 -05:00
James Bardin 06663991d1 Add config path argument to env commands
In order to operate in parity with other commands, the env command
should take a path argument to locate the configuration.

This however introduces the issue of a possible name conflict between a
path and subcommand, or printing an incorrect current environment for
the bare `env` command. In favor of simplicity this removes the current
env output and only prints usage when no subcommand is provided.
2017-02-28 16:07:06 -05:00
James Bardin c8526484b3 split the env command into subcommands 2017-02-28 16:07:06 -05:00
James Bardin 31f033827f Add basic env commands
Used a single command with flags for now. We may refactor this out to
subcommands.
2017-02-28 16:07:06 -05:00
James Bardin e6eb71dde5 Add tests to check Backend delegation
Ensure that when MultiState methods are properly delegated when there is
a defined Local.Backend.
2017-02-28 16:07:06 -05:00
James Bardin 0933541a8c Split out the backend environment interface
Split the interface to change environments out from the minimal Backend
interface, to make it optional for backend implementations. If
backend.MultiState isn't implemented, return a "not implemented" from
environment related methods.

Have the Local backend delegate the MultiState methods to the proper
backend.
2017-02-28 16:06:14 -05:00
James Bardin 1ea9413c07 Remove state path handling from commands
The Local backend is now responsible for handling the paths to the local
state files, since they are dependent on the current environment.
2017-02-28 16:06:14 -05:00
James Bardin dbc45b907c Make the Local backend handle its own named states
Add the functionality required for terraform environments
2017-02-28 16:03:36 -05:00
James Bardin 761c63d14a Update Backend to incorporate environments
Add the missing methods/arguments to handle Terraform environments in
Backends. Extra functionality simply returns defaults for now.
2017-02-28 16:03:36 -05:00
Seth Vargo 03a8e32fed Cache in Fastly for a long time (#12309) 2017-02-28 20:55:39 +00:00
Mitchell Hashimoto 5e533c2ea1 Merge pull request #12308 from hashicorp/b-backend-cliinit
command: use backend.CLIInit
2017-02-28 11:53:42 -08:00
Mitchell Hashimoto 3cedfa00f4
command: use backend.CLIIinit
I made this interface way back with the original backend work and I
guess I forgot to hook it up! This is becoming an issue as I'm working
on our 2nd enhanced backend that requires this information and I
realized it was hardcoded before.

This propertly uses the CLIInit interface allowing any backend to gain
access to this data.
2017-02-28 10:58:29 -08:00
Joe Topjian 85de5f1e04 provider/openstack: Rename provider to loadbalancer_provider (#12239)
* provider/openstack: Rename provider to loadbalancer_provider

This commit renames provider to loadbalancer_provider in the
openstack_lb_loadbalancer_v2 resource.

It also changes security_group_ids to Computed so default
security groups are added to the state correctly.

* provider/openstack: Switch to a deprecation path for loadbalancer provider

This commit switches to using a deprecation path for removal of the
previous "provider" argument in favor of the new "loadbalancer_provider".
2017-02-28 16:06:49 +00:00
James Bardin 92d4809db3 Merge pull request #12242 from hashicorp/jbardin/state-mv-sort
missing default cases in sort from #12219
2017-02-27 08:57:39 -05:00
Brian Flad 4372592f0c
provider/datadog: Add datadog_user resource (#12268)
* provider/datadog: Add datadog_user resource

* provider/datadog: Fix datadog_user import test, simplify datadog_user ACC tests, more consise documentation
2017-02-27 10:38:54 +00:00