Commit Graph

19378 Commits

Author SHA1 Message Date
James Bardin b279b1abb5 check for named s3 states before acquiring a lock
In order to force-unlock a named state, we have to fetch that state
first. Don't attempt to acquire a lock if we know the state already
exists in s3.
2017-05-19 14:40:59 -04:00
James Bardin a2d452acec failing test to force-unlock a named state in s3
The State call attempts to get a lock before determining if a named
state exists. This prevents force-unlock, since we need the state to
call Unlock.
2017-05-19 14:39:42 -04:00
Jake Champlin dffa575591
add docstring on ignored error 2017-05-19 14:36:39 -04:00
Kit Ewbank ca898d8d19 Add ability to 'terraform import' aws_kms_alias resources. 2017-05-19 14:35:54 -04:00
Radek Simko 6266eef652 Update CHANGELOG.md 2017-05-19 17:59:50 +02:00
Radek Simko 79903cd7ea provider/aws: Allow updating tuples in WAF SQLInjectionMatchSet + no tuples (#14667)
* provider/aws: Allow updating tuples in WAF SQL Injection Match Set

* provider/aws: Allow WAF SQL Injection match set with no tuples
2017-05-19 17:59:15 +02:00
Jake Champlin 96e83817ef
provider/aws: validation: Add validation function for IAM Policies
The previous JSON validator that we were using for IAM policy documents wouldn't catch AWS IAM Policy errors.
The supplied policy document would pass our validator, then fail with the following API error:

```
 * aws_iam_role_policy.foo: Error putting IAM role policy tf_test_policy_ymw7hbil9w: MalformedPolicyDocument: The policy failed legacy parsing
                        status code: 400, request id: e7615d90-3c99-11e7-babc-c14e741605bf
```

This happens if the Policy Document doesn't start with the opening JSON bracket, and often happens in the following case:

```
policy = <<EOF
  {
      "Version": "2012-10-17",
      "Statement": [
          {
            ...
          }
      ]
  }
  EOF
```

Where, when using a HEREDOC, the policy document is indented incorrectly.

The new validation function for the IAM policies verifies that the first character of the supplied policy document is the leading JSON bracket, prior to validating the JSON string.

Test Output:

```
$ make test TEST=./builtin/providers/aws/ TESTARGS="-v -run=TestValidateIAMPolicyJsonString"
==> Checking that code complies with gofmt requirements...
==> Checking AWS provider for unchecked errors...
==> NOTE: at this time we only look for uncheck errors in the AWS package
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/19 10:56:32 Generated command/internal_plugin_list.go
go test -i ./builtin/providers/aws/ || exit 1
echo ./builtin/providers/aws/ | \
        xargs -t -n4 go test -v -run=TestValidateIAMPolicyJsonString -timeout=60s -parallel=4
go test -v -run=TestValidateIAMPolicyJsonString -timeout=60s -parallel=4 ./builtin/providers/aws/
=== RUN   TestValidateIAMPolicyJsonString
--- PASS: TestValidateIAMPolicyJsonString (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    0.009s
```

```
$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAWSPolicy_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/19 10:38:43 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAWSPolicy_ -timeout 120m
=== RUN   TestAWSPolicy_namePrefix
--- PASS: TestAWSPolicy_namePrefix (20.01s)
=== RUN   TestAWSPolicy_invalidJson
--- PASS: TestAWSPolicy_invalidJson (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    20.027s
```

```
$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSIAMRolePolicy_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/19 11:02:56 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSIAMRolePolicy_ -timeout 120m
=== RUN   TestAccAWSIAMRolePolicy_importBasic
--- PASS: TestAccAWSIAMRolePolicy_importBasic (18.45s)
=== RUN   TestAccAWSIAMRolePolicy_basic
--- PASS: TestAccAWSIAMRolePolicy_basic (35.92s)
=== RUN   TestAccAWSIAMRolePolicy_namePrefix
--- PASS: TestAccAWSIAMRolePolicy_namePrefix (14.78s)
=== RUN   TestAccAWSIAMRolePolicy_generatedName
--- PASS: TestAccAWSIAMRolePolicy_generatedName (20.20s)
=== RUN   TestAccAWSIAMRolePolicy_invalidJSON
--- PASS: TestAccAWSIAMRolePolicy_invalidJSON (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    89.363s
```
2017-05-19 11:11:44 -04:00
Paul Stack 2065824729 Update CHANGELOG.md 2017-05-19 17:24:44 +03:00
Paul Stack 65283fb47c provider/aws: Change AWS ssm_maintenance_window Read func (#14665)
Fixes: #14653

I was originally calling the wrong API method and only some of the
values were being persisted to state. By changing the API method, we can
now get all of the values and therefore can detech manual drift

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSSMMaintenanceWindow_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/19 16:56:27 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSSMMaintenanceWindow_ -timeout 120m
=== RUN   TestAccAWSSSMMaintenanceWindow_basic
--- PASS: TestAccAWSSSMMaintenanceWindow_basic (41.39s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	41.419s
```
2017-05-19 17:23:40 +03:00
Paul Stack 11279963a3 Update CHANGELOG.md 2017-05-19 17:02:37 +03:00
David Glasser 783908ee25 core: fix bad Sprintf in backend migration message (#14601)
Before this, invoking this codepath would print

    Terraform has successfully migrated from legacy remote state to your
    configured remote state.%!(EXTRA string=s3)
2017-05-19 17:01:44 +03:00
Radek Simko 96532c4f11 Update CHANGELOG.md 2017-05-19 16:01:26 +02:00
Radek Simko a567cf00ce Merge pull request #14661 from hashicorp/b-aws-waf-size-constraint
provider/aws: Allow updating constraints in WAF SizeConstraintSet + no constraints
2017-05-19 16:00:36 +02:00
Radek Simko cacaf91ff2 provider/aws: Increase timeout for retrying deletion IAM server cert (#14655) 2017-05-19 16:37:07 +03:00
Jake Champlin ff06ffdf81 Merge pull request #14662 from hashicorp/f-travis-vet
update travis to catch vet failures
2017-05-19 09:31:52 -04:00
Jake Champlin 7c6e19689f Merge pull request #14629 from pradeepbhadani/pow
Add note in documentation for pow function
2017-05-19 09:15:39 -04:00
Jake Champlin 76e99dcff4
update travis to catch vet failures 2017-05-19 09:12:56 -04:00
Pradeep Bhadani 9b3e43016e Remove extra space 2017-05-19 14:01:54 +01:00
Annie Hedgpeth 1a0c680a63 provider/azurerm: Add example of encrypting a running linux (#14642)
* initial commit - 101-vm-from-user-image

* changed branch name

* not deploying - storage problems

* provisions vm but image not properly prepared

* storage not correct

* provisions properly

* changed main.tf to azuredeploy.tf

* added tfvars and info for README

* tfvars ignored and corrected file ext

* added CI config; added sane defaults for variables; updated deployment script, added mac specific deployment for local testing

* deploy.sh to be executable

* executable deploy files

* added CI files; changed vars

* prep for PR

* removal of old folder

* prep for PR

* wrong args for travis

* more PR prep

* updated README

* commented out variables in terraform.tfvars

* Topic 101 vm from user image (#2)

* initial commit - 101-vm-from-user-image
* added tfvars and info for README
* added CI config; added sane defaults for variables; updated deployment script, added mac specific deployment for local testing
* prep for PR

* added new template

* oops, left off master

* prep for PR

* correct repository for destination

* renamed scripts to be more intuitive; added check for docker

* merge vm simple; vm from image

* initial commit

* deploys locally

* updated deploy

* consolidated deploy and after_deploy into a single script; simplified ci process; added os_profile_linux_config

* added terraform show

* changed to allow http & https (like ARM tmplt)

* changed host_name & host_name variable desc

* added az cli check

* on this branch, only build test_dir; master will aggregate all the examples

* merge master

* added new constructs/naming for deploy scripts, etc.

* suppress az login output

* suppress az login output

* forgot about line breaks

* breaking build as an example

* fixing broken build example

* merge of CI config

* fixed grammar in readme

* prep for PR

* took out armviz button and minor README changes

* changed host_name

* fixed merge conflicts

* changed host_name variable

* updating Hashicorp's changes to merged simple linux branch

* updating files to merge w/master and prep for Hashicorp pr

* Revert "updating files to merge w/master and prep for Hashicorp pr"

This reverts commit b850cd5d2a858eff073fc5a1097a6813d0f8b362.

* Revert "updating Hashicorp's changes to merged simple linux branch"

This reverts commit dbaf8d14a9cdfcef0281919671357f6171ebd4e6.

* removing vm from user image example from this branch

* removed old branch

* azure-2-vms-loadbalancer-lbrules (#13)

* initial commit

* need to change lb_rule & nic

* deploys locally

* updated README

* updated travis and deploy scripts for Hari's repo

* renamed deploy script

* clean up

* prep for PR

* updated readme

* fixing conflict in .travis.yml

* initial commit; in progress

* in progress

* in progress; encryption fails

* in progress

* deploys successfully locally

* clean up; deploy typo fixed

* merging hashi master into this branch

* troubleshooting deploy

* added missing vars to deploy script

* updated README, outputs, and added graph

* simplified outputs

* reverting to Hashicorp's .travis.yml

* clean up

* readme graph correction
2017-05-19 13:21:13 +03:00
Annie Hedgpeth d9fb2cfd04 provider/azurerm: Add example of sql database (#14649)
* initial commit - 101-vm-from-user-image

* changed branch name

* not deploying - storage problems

* provisions vm but image not properly prepared

* storage not correct

* provisions properly

* changed main.tf to azuredeploy.tf

* added tfvars and info for README

* tfvars ignored and corrected file ext

* added CI config; added sane defaults for variables; updated deployment script, added mac specific deployment for local testing

* deploy.sh to be executable

* executable deploy files

* added CI files; changed vars

* prep for PR

* removal of old folder

* prep for PR

* wrong args for travis

* more PR prep

* updated README

* commented out variables in terraform.tfvars

* Topic 101 vm from user image (#2)

* initial commit - 101-vm-from-user-image
* added tfvars and info for README
* added CI config; added sane defaults for variables; updated deployment script, added mac specific deployment for local testing
* prep for PR

* added new template

* oops, left off master

* prep for PR

* correct repository for destination

* renamed scripts to be more intuitive; added check for docker

* merge vm simple; vm from image

* initial commit

* deploys locally

* updated deploy

* consolidated deploy and after_deploy into a single script; simplified ci process; added os_profile_linux_config

* added terraform show

* changed to allow http & https (like ARM tmplt)

* changed host_name & host_name variable desc

* added az cli check

* on this branch, only build test_dir; master will aggregate all the examples

* merge master

* added new constructs/naming for deploy scripts, etc.

* suppress az login output

* suppress az login output

* forgot about line breaks

* breaking build as an example

* fixing broken build example

* merge of CI config

* fixed grammar in readme

* prep for PR

* took out armviz button and minor README changes

* changed host_name

* fixed merge conflicts

* changed host_name variable

* updating Hashicorp's changes to merged simple linux branch

* updating files to merge w/master and prep for Hashicorp pr

* Revert "updating files to merge w/master and prep for Hashicorp pr"

This reverts commit b850cd5d2a858eff073fc5a1097a6813d0f8b362.

* Revert "updating Hashicorp's changes to merged simple linux branch"

This reverts commit dbaf8d14a9cdfcef0281919671357f6171ebd4e6.

* removing vm from user image example from this branch

* removed old branch

* azure-2-vms-loadbalancer-lbrules (#13)

* initial commit

* need to change lb_rule & nic

* deploys locally

* updated README

* updated travis and deploy scripts for Hari's repo

* renamed deploy script

* clean up

* prep for PR

* updated readme

* fixing conflict in .travis.yml

* initial commit; missing resource for transparentDataEncryption

* commented out missing resources for TDE

* updated .travis.yml

* typo fix on .travis.yml

* changed directory name to omit TDE

* deploy troubleshooting

* password troubleshooting

* troubleshooting password

* merging hashi master into this branch

* reverting to Hashicorp's .travis.yml

* added graph to README
2017-05-19 10:22:10 +01:00
Pradeep Bhadani d316205cf5 Remove extra line 2017-05-19 08:05:18 +00:00
Radek Simko bf99b53d17
provider/aws: Allow WAF SizeConstraint with no tuples 2017-05-19 09:20:33 +02:00
Radek Simko 3fb671be1f
provider/aws: Allow updating constraints in WAF SizeConstraintSet 2017-05-19 09:20:26 +02:00
Radek Simko ac25ac954c Update CHANGELOG.md 2017-05-19 09:14:49 +02:00
Radek Simko afe45b62df provider/aws: Allow updating tuples in WAF ByteMatchSet + no tuples (#14071)
* provider/aws: Allow updating tuples in WAF ByteMatchSet

* provider/aws: Allow WAF ByteMatchSet with no tuples
2017-05-19 09:13:58 +02:00
Paddy 2c94b46b14 provider/google: detach disks before deleting them.
When a `google_compute_disk` is attached to a `google_compute_instance`,
deleting can be tricky. GCP doesn't allow disks that are attached to
instances to be deleted. Normally, this is fine; the instance depends on
the disk, so by the time the disk is deleted, the instance should
already be gone.

However, some reports have cropped up (#8667) that deleting disks is
failing because they're still attached to instances. Though this
shouldn't happen, it appears it can happen under some unknown
conditions.

This PR adds logic that will attempt to detach disks from any instances
they're attached to before deleting the disks, adding another safeguard
that should prevent this behaviour.
2017-05-18 17:28:16 -07:00
Jake Champlin fcdf494cff Merge pull request #14646 from hashicorp/f-update-route-table-docs-note
docs/aws: add note for aws_route_table resource
2017-05-18 17:29:32 -04:00
Jake Champlin b38210c597
docs/aws: add note for aws_route_table resource 2017-05-18 17:12:11 -04:00
Dana Hoffman a47d0544a9 Update CHANGELOG.md 2017-05-18 13:36:01 -07:00
Matt Robenolt 27927ddc2c provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
Clint 208199a554 Update CHANGELOG.md 2017-05-18 15:30:29 -05:00
Mike Tougeron 0e29b744df Mark the aws & gcs secrets as sensitive (#14634) 2017-05-18 15:29:13 -05:00
clint shryock a8c2828b63 provider/google: Update docs to match new default value 2017-05-18 15:10:52 -05:00
Clint 025d7ea8c9 Update CHANGELOG.md 2017-05-18 15:10:00 -05:00
Clint c3d2f6bbe4 Fix issue with GCP Cloud SQL Instance `disk_autoresize` (#14582)
* provider/google: Fix server/state diff with disk_autoresize

* provider/google: Default true for disk.auto_resize

For sql_database_instance , to match the new API default.

Also adds diff suppression func for autoresize on 1st gen instances

* fix typos
2017-05-18 15:09:01 -05:00
Paddy e7dcf95fa1 Merge pull request #14644 from hashicorp/paddy_gcp_remove_project_services_docs
provider/google: remove deleted services field.
2017-05-18 12:55:20 -07:00
clint shryock aae44290cd merge master 2017-05-18 13:56:55 -05:00
Ryon adfa7aedfb Update news section with YAML data file (#14612)
* Update news section with April 4 webinar video

* Use YAML data file for news; add webinar registration CTA
2017-05-18 18:49:52 +03:00
Radek Simko cc505b2d61 Update CHANGELOG.md 2017-05-18 17:41:28 +02:00
Radek Simko 740c92fc67 provider/aws: Support filtering in ASG data source (#14501) 2017-05-18 17:40:49 +02:00
Jake Champlin 04c62ae406 Merge pull request #14628 from jasonmcintosh/patch-1
Fixed export to be master_username from username
2017-05-18 11:36:04 -04:00
Pradeep Bhadani c35d2325ef Update pow function description 2017-05-18 15:23:12 +00:00
Jason eac7ade310 Fixed export to be master_username from username
rds cluster exports the variable for "username" as master_username, not username.
2017-05-18 10:17:48 -05:00
Jake Champlin 0b2d02fc41 Update CHANGELOG.md 2017-05-18 11:13:22 -04:00
Jake Champlin 5e7035bf89 Merge pull request #14598 from pradeepbhadani/pow
Add power function
2017-05-18 11:12:33 -04:00
Pradeep Bhadani faa480894f Add note in documentation for pow function 2017-05-18 15:03:13 +00:00
Pradeep Bhadani 2c39887706 Add fail test - one parameter, non-numeric parameter 2017-05-18 14:30:10 +00:00
Paul Stack 56fa4c7e0d Update CHANGELOG.md 2017-05-18 17:29:42 +03:00
Paul Stack 62347ea833 provider/aws: Fall back to old tagging mechanism for AWS gov and aws China (#14627)
Fixes: #14535

When in a `restricted` cloud, we should fall back to the old method of
tagging. Before this change we saw the following:

```
% terraform apply                                                                                                                                                                                         ✭
aws_instance.foo: Creating...
  ami:                          "" => "ami-0fa3c42c"
  associate_public_ip_address:  "" => "<computed>"
  availability_zone:            "" => "<computed>"
  ebs_block_device.#:           "" => "<computed>"
  ephemeral_block_device.#:     "" => "<computed>"
  instance_state:               "" => "<computed>"
  instance_type:                "" => "m1.small"
  ipv6_address_count:           "" => "<computed>"
  ipv6_addresses.#:             "" => "<computed>"
  key_name:                     "" => "<computed>"
  network_interface.#:          "" => "<computed>"
  network_interface_id:         "" => "<computed>"
  placement_group:              "" => "<computed>"
  primary_network_interface_id: "" => "<computed>"
  private_dns:                  "" => "<computed>"
  private_ip:                   "" => "<computed>"
  public_dns:                   "" => "<computed>"
  public_ip:                    "" => "<computed>"
  root_block_device.#:          "" => "<computed>"
  security_groups.#:            "" => "<computed>"
  source_dest_check:            "" => "true"
  subnet_id:                    "" => "<computed>"
  tags.%:                       "" => "1"
  tags.foo:                     "" => "bar"
  tenancy:                      "" => "<computed>"
  volume_tags.%:                "" => "<computed>"
  vpc_security_group_ids.#:     "" => "<computed>"
aws_instance.foo: Creation complete (ID: i-0009f227ae24791b9)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

% 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_instance.foo: Refreshing state... (ID: i-0009f227ae24791b9)
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_instance.foo
    tags.%:   "0" => "1"
    tags.foo: "" => "bar"

Plan: 0 to add, 1 to change, 0 to destroy.
```

After this patch, we see the following:

```
% terraform apply                                                                                                                                                                                       ✹ ✭
[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
aws_instance.foo: Creating...
  ami:                          "" => "ami-0fa3c42c"
  associate_public_ip_address:  "" => "<computed>"
  availability_zone:            "" => "<computed>"
  ebs_block_device.#:           "" => "<computed>"
  ephemeral_block_device.#:     "" => "<computed>"
  instance_state:               "" => "<computed>"
  instance_type:                "" => "m1.small"
  ipv6_address_count:           "" => "<computed>"
  ipv6_addresses.#:             "" => "<computed>"
  key_name:                     "" => "<computed>"
  network_interface.#:          "" => "<computed>"
  network_interface_id:         "" => "<computed>"
  placement_group:              "" => "<computed>"
  primary_network_interface_id: "" => "<computed>"
  private_dns:                  "" => "<computed>"
  private_ip:                   "" => "<computed>"
  public_dns:                   "" => "<computed>"
  public_ip:                    "" => "<computed>"
  root_block_device.#:          "" => "<computed>"
  security_groups.#:            "" => "<computed>"
  source_dest_check:            "" => "true"
  subnet_id:                    "" => "<computed>"
  tags.%:                       "" => "1"
  tags.foo:                     "" => "bar"
  tenancy:                      "" => "<computed>"
  volume_tags.%:                "" => "<computed>"
  vpc_security_group_ids.#:     "" => "<computed>"
aws_instance.foo: Creation complete (ID: i-04cd122e28f167a14)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

% 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_instance.foo: Refreshing state... (ID: i-04cd122e28f167a14)
No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, Terraform
doesn't need to do anything.
```
2017-05-18 17:28:37 +03:00
Jake Champlin 66b7a24b4f Update CHANGELOG.md 2017-05-18 09:55:41 -04:00