Commit Graph

7562 Commits

Author SHA1 Message Date
Dana Hoffman 3df593315f provider/google: add failover parameter to sql database instance (#14336)
* provider/google: add failover parameter to sql database instance

* provider/google: update sql database instance docs
2017-05-22 13:44:25 -07:00
Riley Karson 56f89e20d7 provider/google: Add import support to google_sql_user (#14457)
* Support importing google_sql_user

* Updated documentation to reflect that passwords are not retrieved.

* Added additional documentation detailing use.

* Removed unneeded d.setId() line from GoogleSqlUser Read method.

* Changed an errors.New() call to fmt.Errorf().

* Migrate schemas of existing GoogleSqlUser resources.

* Remove explicitly setting 'id' property

* Added google_sql_user to importability page.

* Changed separator to '/' from '.' and updated tests + debug messages.
2017-05-22 13:43:10 -07:00
Riley Karson 6ac78404e0 provider/google: Refactor google_storage_bucket tests (#14694) 2017-05-22 12:38:21 -07:00
Jake Champlin 9a7a243c5c Merge pull request #14733 from hashicorp/f-env-var-prerelease-string
core: Use environment variables to set VersionPrerelease at compile time
2017-05-22 14:55:00 -04:00
smasue bc3075c48b Missing short name in the service scope (Google compute instance) (#14633)
* Missing short name in the service scope (Google compute instance ). The missing short name is for Stackdriver Trace append.

* Missing short name in the service scope (Google compute instance ). The missing short name is for Stackdriver Trace readonly.
2017-05-22 12:21:59 -05:00
Joe Topjian cfb83f9d87 Merge pull request #14704 from jtopjian/openstack-instance-tenantnet-fix
provider/openstack: Catch error during instance network parsing
2017-05-22 09:29:11 -06:00
Joe Topjian a8bf3d8ab0 Merge pull request #14721 from jtopjian/os-dns
provider/openstack: Add openstack_dns_zone_v2 resource
2017-05-22 09:27:28 -06:00
Jake Champlin bd68789006
core: Use environment variables to set VersionPrerelease at compile time
Instead of using a hardcoded version prerelease string, which makes release automation difficult, set the version prerelease string from an environment variable via the go linker tool during compile time.

The environment variable `TF_RELEASE` should only be set via the `make bin` target, and thus leaves the version prerelease string unset. Otherwise, when running a local compile of terraform via the `make dev` makefile target, the version prerelease string is set to `"dev"`, as usual.

This also requires some changes to both the circonus and postgresql providers, as they directly used the `VersionPrerelease` constant. We now simply call the `VersionString()` function, which returns the proper interpolated version string with the prerelease string populated correctly.

`TF_RELEASE` is unset:

```sh
$ make dev
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/22 10:38:19 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 209M
-rwxr-xr-x 1 jake jake 209M May 22 10:39 terraform

$ terraform version
Terraform v0.9.6-dev (fd472e4a86500606b03c314f70d11f2bc4bc84e5+CHANGES)
```

`TF_RELEASE` is set (mimicking the `make bin` target):

```sh
$ TF_RELEASE=1 make dev
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/22 10:40:39 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 121M
-rwxr-xr-x 1 jake jake 121M May 22 10:42 terraform

$ terraform version
Terraform v0.9.6
```
2017-05-22 10:49:15 -04:00
Jake Champlin 722436a880 Merge pull request #14727 from hashicorp/b-fix-instance-panic
provider/aws: Fix panic on instance shutdown
2017-05-22 09:53:04 -04:00
Kit Ewbank 8e130b15e4 Add 'aws_kms_ciphertext' data source. (#14691) 2017-05-22 16:46:18 +03:00
Máximo Cuadros b8fb1b5ed9 ignition: tests as unit test (#14703) 2017-05-22 16:40:41 +03:00
Raphaël Pinson e7bfdea274 Add github_team data source (#14614)
* Add github_team data source

* github_team: add doc

* github_team data source: fix acceptance test
2017-05-22 16:29:18 +03:00
Januar cf8568fe55 provider/docker network alias (#14710)
* Add Network Alias configuration with network options

* Handle case where there's no network option

* Handle use case where network option is not available

* Handle use case where network option is not available

* Network alias only on user defined network

* Update documentation for docker provider on network aliases

* Remove unused variable

* Update documentation

* add unit test for docker container network

* fix unit test for docker container network
2017-05-22 09:20:32 -04:00
Radek Simko b90ad412d5 provider/aws: Increase timeout for creating security group (#14724) 2017-05-22 15:12:39 +02:00
Jake Champlin c1f4a6e9f8
provider/aws: Fix panic on instance shutdown
During an instance shut-down network interfaces may be detached during the `READ` method of a Terraform run.

This protects the case where a network interface was detached, and is now `nil` at the time of the Terraform run, fixing nil pointer dereferences.
2017-05-22 09:02:35 -04:00
Jake Champlin d85b8f0613 Merge pull request #14669 from hashicorp/b-add-validation-iam-role-policy
provider/aws: validation: Add validation function for IAM Policies
2017-05-22 08:26:24 -04:00
Paul Stack 542640c953 provider/aws: Do not dereference source_Dest_check in aws_instance (#14723)
Fixes: #14718

source_dest_check may not be set so we should pass the pointer to d.Set
func and allow it to dereference it safely
2017-05-22 10:44:30 +03:00
Radek Simko 600e587430 provider/aws: Configurable timeouts for EC2 instance + spot instance (#14711) 2017-05-22 09:27:06 +02:00
Radek Simko a6617c598a provider/aws: Increase timeout for retrying creation of CW log subs (#14722) 2017-05-22 09:26:24 +02:00
Radek Simko 9cb33d863d provider/aws: Increase timeout for deleting IGW (#14705) 2017-05-22 09:25:26 +02:00
Joe Topjian e0b5f4f833 provider/openstack: dns zone v2 updates and docs 2017-05-22 01:44:11 +00:00
jrperritt 5792b9fe76 provider/openstack: Add openstack_dns_zone_v2 resource 2017-05-22 01:44:11 +00:00
Radek Simko 4a671fc92e provider/aws: Retry IAM Role deletion on DeleteConflict (#14707)
* provider/aws: Retry IAM Role deletion on DeleteConflict

* provider/aws: Add 'IAM' to relevant test names
2017-05-22 00:35:09 +03:00
Radek Simko 3a41e45180 provider/aws: Retry ECS service update on InvalidParameterException (#14708) 2017-05-21 22:19:41 +03:00
Joe Topjian 6fe0471008 provider/openstack: Catch error during instance network parsing
This commit catches an error when the instance is parsing and building
its network list. This can happen when a cloud provider responds with
a non-JSON response for the list of networks.
2017-05-21 02:34:57 +00:00
Radek Simko 60bae99a94 provider/aws: Retry ElastiCache cluster deletion when it's snapshotting (#14700) 2017-05-21 00:42:33 +03:00
Radek Simko 66ed50866d provider/aws: Increase timeout for creation of route_table (#14701) 2017-05-21 00:40:33 +03:00
Radek Simko c0a2aa3b49 provider/aws: Allow updating tuples in WAF XssMatchSet + no tuples (#14671)
* provider/aws: Allow updating tuples in WAF XssMatchSet

* provider/aws: Allow WAF XssMatchSet with no tuples
2017-05-20 02:55:58 +02:00
Jake Champlin 6772360c2d Merge pull request #14688 from harijayms/manageddisk4TB
[MS] Adding support for 4TB disks
2017-05-19 17:57:54 -04:00
Jake Champlin 90b5d81933 Merge pull request #14685 from hashicorp/f-open-lightsail-regions
provider/aws: Allow lightsail resources to work in other regions
2017-05-19 17:16:13 -04:00
Eugene Chuvyrov 662373e12e Adding support for 4TB disks 2017-05-19 14:10:19 -07:00
Jake Champlin 85895cecc7
provider/aws: rename usEast1Sess to r53Sess and document 2017-05-19 17:03:34 -04:00
Jake Champlin 22a82c0dfb Merge pull request #14683 from ewbankkit/github-provider-handle-nil-response
provider/github Check for potentially nil response from GitHub API client
2017-05-19 16:46:38 -04:00
Jake Champlin 0abfda4d8b
provider/aws: Allow lightsail resources to work in other regions
Previously lightsail was limited to `us-east-1` only. This restriction has now been lifted to new regions.

```
$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSLightsailInstance_euRegion'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/19 16:40:48 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSLightsailInstance_euRegion -timeout 120m
=== RUN   TestAccAWSLightsailInstance_euRegion
--- PASS: TestAccAWSLightsailInstance_euRegion (45.31s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    45.319s
```

Fixes: #14668
2017-05-19 16:44:07 -04:00
Kit Ewbank 7795904f78 Check for potentially nil response from GitHub API client. 2017-05-19 15:19:54 -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 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 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
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
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 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
Matt Robenolt 27927ddc2c provider/google: Add support for privateIpGoogleAccess on subnetworks (#14234) 2017-05-18 13:35:02 -07:00
Mike Tougeron 0e29b744df Mark the aws & gcs secrets as sensitive (#14634) 2017-05-18 15:29:13 -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
Radek Simko 740c92fc67 provider/aws: Support filtering in ASG data source (#14501) 2017-05-18 17:40:49 +02: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