Commit Graph

137 Commits

Author SHA1 Message Date
Paul Stack 0adc1fc4b2 provider/aws: Allow `aws_rds_instance` to upgrade the major version (#8471)
Fixes #8468

If a user wished to bump the `engine_version` of an RDS instance,
Terraform was not sending `allow_major_version_upgrade` to the API
*unless* that value also changed at the same time. This caused the
following error from RDS API:

```
* aws_db_instance.bar: Error modifying DB Instance
* tf-20160825101420910562798obb: InvalidParameterCombination: The
* AllowMajorVersionUpgrade flag must be present when upgrading to a new
* major version.
    status code: 400, request id: 20e36364-6ab0-11e6-b794-51f12f4135f1
```

This change will always send the `allow_major_version_upgrade` flag to
the API when the `engine_version` changes.

This still relies on the user setting the correct value i.e. if they are
upgrading from postgres 0.4.7 -> 9.5.2 then the config will need to set
the `allow_major_version_upgrade` flag to be `true`
2016-08-25 13:54:40 +01:00
Paul Stack 5c0662f0eb provider/aws: Change the way ARNs are built (#7151)
ARNs used to be build using the iamconn.GetUser func call. This wouldn't
work on some scenarios and was changed so that we can expose the
AccountId and Region via meta

This commit just changes the build ARN funcs to use this new way of
doing things
2016-08-07 17:36:00 +10:00
Paul Hinze 93832527b1
provider/aws: Fixup skip_final_snapshot import
Neither skip_final_snapshot nor final_snapshot_identifier can be fetched
from any API call, so we need to default skip_final_snapshot to true
during import so that final_snapshot_identifier is not required
2016-07-15 11:30:33 -06:00
Paul Stack 303ba86cf6 provider/aws: Allow `port` on `aws_db_instance` to be updated (#7441)
Fixes #2439

Port used to ForceNew, it has now been changed to allow it to be
updated. 2 changes were needed:

1. Setting the port back to state
2. Adding the wait for state function to the Update func

```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSDBInstance_portUpdate'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSDBInstance_portUpdate -timeout 120m
=== RUN   TestAccAWSDBInstance_portUpdate
--- PASS: TestAccAWSDBInstance_portUpdate (699.84s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    699.861s
```
2016-07-12 09:07:25 +01:00
stack72 80aeabec83
provider/aws: Support Import of `aws_db_instance`
JUst needed some rejigging of the skip_final_snapshot work as that isn't
returned by the API and skipping it means the destroy fails due to
missing final_snapshot_identifier

```
% make testacc TEST=./builtin/providers/aws
% TESTARGS='-run=TestAccAWSDBInstance_'                              ✹ ✭
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/07/07 15:28:31 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSDBInstance_
-timeout 120m
=== RUN   TestAccAWSDBInstance_importBasic
--- PASS: TestAccAWSDBInstance_importBasic (588.70s)
=== RUN   TestAccAWSDBInstance_basic
--- PASS: TestAccAWSDBInstance_basic (595.71s)
=== RUN   TestAccAWSDBInstance_kmsKey
--- PASS: TestAccAWSDBInstance_kmsKey (726.46s)
=== RUN   TestAccAWSDBInstance_optionGroup
--- PASS: TestAccAWSDBInstance_optionGroup (681.78s)
=== RUN   TestAccAWSDBInstance_iops_update
--- PASS: TestAccAWSDBInstance_iops_update
(590.81s)
```

Please note that I cannot run the enhanced monitoring test in my
environment as I have already got it attached to an IAM role. Running
that test gives me this result:

```

```
2016-07-07 16:26:35 +01:00
Clint f4a1833baf provider/aws: Bundle IOPs and Allocated Storage update for DB Instances (#7203) 2016-06-21 14:53:13 -05:00
Paul Stack 5e23e87c30 provider/aws: `aws_db_instance` change to the default for (#7118)
`publicly_accessible` to be false
2016-06-11 00:13:53 +02:00
Paul Stack 5ecc8e3169 provider/aws: `aws_db_instance` now defaults `publicly_accessible` to (#7117)
false

Fixes #7035

A known issue in Terraform means that d.GetOk() on a bool which is false
will mean it doesn't get evaulated. Therefore, when people set
publicly_accessible to false, it will never get evaluated on the Create

We are going to make it default to false now
2016-06-10 23:55:36 +02:00
stack72 b3d680eee0 Merge branch 'master' of https://github.com/statoilfuelretail/terraform into statoilfuelretail-master 2016-06-02 18:06:37 +01:00
Chris Marchesi 9d7fb89114 core: Adding Sensitive attribute to resource schema
This an effort to address hashicorp/terraform#516.

Adding the Sensitive attribute to the resource schema, opening up the
ability for resource maintainers to mark some fields as sensitive.
Sensitive fields are hidden in the output, and, possibly in the future,
could be encrypted.
2016-05-29 22:18:44 -07:00
Paul Stack cf37c3adaa provider/aws: Add support for `kms_key_id` to `aws_db_instance` (#6651)
As requested in #4822, add support for a KMS Key ID (ARN) for Db
Instance

```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSDBInstance_kmsKey' 2>~/tf.log
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSDBInstance_kmsKey -timeout 120m
=== RUN   TestAccAWSDBInstance_basic
--- PASS: TestAccAWSDBInstance_basic (587.37s)
=== RUN   TestAccAWSDBInstance_kmsKey
--- PASS: TestAccAWSDBInstance_kmsKey (625.31s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    1212.684s
```
2016-05-13 11:20:29 -05:00
stack72 8dc123fd94 Scaffold the AWS DB Option Group resource
Change the AWS DB Instance to now include the DB Option Group param. Adds a test to prove that it works

Add acceptance tests for the AWS DB Option Group work. This ensures that Options can be added and updated

Documentation for the AWS DB Option resource
2016-05-08 20:18:53 +01:00
Clint ccb9693994 Merge pull request #5676 from Originate/mb-ensure-iops-is-provided
provider/aws: Provide iops when changing storage type to io1 on RDS
2016-03-23 08:31:21 -05:00
Paul Hinze 4e5429a140 provider/aws: ability to generate unique RDS identifier
Needed to truncate the identifier for SQL Server engines to keep it at
max 15 chars per the docs. Not a full UUID going into it, but should be
"unique enough" to not matter in practice.

Modified the basic test to use the generated value. Other tests are
still working w/ explicitly specified identifiers.
2016-03-18 16:07:37 -05:00
Paul Hinze 17775205f7 provider/aws: fix crash when Aurora instance disappears
Usage of a helper function was assuming that an error would be returned
in a not found condition, when in fact a nil pointer was
returned.

Attached test crashes w/o fix, passes with it.

Fixes #5350
Refs #5418
2016-03-18 12:27:57 -05:00
Maxime Bury 210eb3571e Provide iops when changing storage type to io1 2016-03-16 18:32:11 -04:00
Paul Hinze 108ccf0007 builtin: Refactor resource.Retry to clarify return
Change the `RetryFunc` from a plain `error` return type to a
specialized `RetryError` which must decide whether it is
retryable or not.

Add `RetryableError` / `NonRetryableError` factory functions that
callers are meant to use to build up these errors.

This makes it eminently clear whether or not a given error is
retryable from inside the client code.

Goal here is to _not_ change any behavior, simply reflect the
existing behavior with the new, clearer, API.
2016-03-09 17:37:56 -06:00
Clint d14920adaf Merge pull request #5515 from hashicorp/b-aws-acc-test-updates
provider/aws: Retry DB Creation on IAM propigation error
2016-03-09 15:08:13 -06:00
Maxime Bury 9e0bac6c9f Terraform should keep track of the publicly accessible attribute 2016-03-09 13:33:00 -05:00
clint shryock c29e1f24b8 provider/aws: Retry DB Creation on IAM propigation error 2016-03-08 14:09:42 -06:00
Paul Stack d5fb018250 Merge pull request #4945 from stack72/aws-rds-enhanced-monitoring
provider/aws: Enabled Enhanced Monitoring for RDS
2016-02-22 22:02:09 +00:00
clint shryock ca29437581 provider/aws: Fix copy_tags_to_snapshot for DB Instance 2016-02-18 11:33:21 -06:00
clint shryock 21a59fc708 provider/aws: All security group mods on first run when restoring from snapshot 2016-02-11 16:39:53 -06:00
Diego Rodriguez cfafa3f574 fix ec2 classic security group changing 2016-02-03 00:33:42 -08:00
stack72 e87d3bb711 Enabled Enhanced Monitoring for RDS 2016-02-03 00:14:24 +00:00
Lars Bahner 8f2d39be45 On Oracle RDS DB instances you can't change the encoding
of the database after creation. So we need to be able to
set the CharacterSetName on creation.
This is an option and will automagically default to
AL32UTF8.

The AWS SDK will give you an error message if you try to
apply this setting to other engines. The patch will only
report the character_set_name attribute, if CharacterSetName
is set on the instance.

Signed-off-by: Lars Bahner <lars.bahner@gmail.com>
2016-01-27 18:39:00 +01:00
Ian Duffy 47ac10d66b Change resource.StateChangeConf to use an array for target states
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-01-21 01:20:41 +00:00
Koen De Causmaecker 45ef11e59f provider/aws: aws_db_instance: unrequire fields
When spinning up from a snapshot or a read replica, these fields are
now optional:
* allocated_storage
* engine
* password
* username

Some validation logic is added to make these fields required when
starting a database from scratch.
The documentation is updated accordingly.
2016-01-13 15:40:15 +01:00
James Nugent 3c330f6e19 provider/aws: Fix RDS unexpected state config
This commit adds the various states (taken from the RDS documentation
here: http://amzn.to/1OHqi6g) to the list of allowable pending states
when creating an RDS instance.

In particular, `resetting-master-credentials` is returned when creating
an `aws_db_instance` from a snapshot. Fixes #4477.
2016-01-04 13:24:29 -05:00
stack72 2b0c7aa4e9 Making the changes to db_instance skip_final_snapshot on the feedback from @catsby 2015-12-10 23:21:36 +00:00
stack72 6082e3e732 Changing the db_instance to throw an error is a final snapshot is required but yet no identified is given 2015-12-10 19:11:47 +00:00
stack72 5796b13373 Adding skip_final_snapshop bool to th db_instance. This will allow us to specify whether a snapshot is needed directly rather than checking for an empty string 2015-12-10 19:11:47 +00:00
clint shryock 6015874273 providers/aws: Update DB Replica to honor storage type
DB Replica can be of a different storage type, but we were skipping that part.
Note that they are created as the default (or as the primary?) initially,
and then modified to be of the correct type
2015-12-09 13:24:10 -06:00
clint shryock e52af33db7 remove extra DBSubnetGroupName 2015-12-08 10:55:57 -06:00
clint shryock 0619898f6a provider/aws: Add arn to DB Instance output 2015-12-08 10:52:17 -06:00
Philipp Preß 1cd2fea1f9 Fix AWS RDS cross-region read replica always being placed in default VPC
Fixes #4192 by honouring the `db_subnet_group_name` parameter when creating a cross-region read replica.
2015-12-08 15:06:57 +01:00
Brandon Rochon 6875e9aaec Issue #3894 RDS publicly_accessible param shouldn't force new resource
Change-Id: I0a10e050ca1c4f2dde5e04f237de6115723522d8
2015-11-16 17:47:35 -08:00
Brandon Rochon b6738f13c1 Issue #3894 RDS publicly_accessible param shouldn't force new resource
Change-Id: I833f9e07f3fc1f6ee475673ad978b3982f0b6273
2015-11-12 13:33:27 -08:00
clint shryock 03e7c6cf12 default true for auto_minor_update and allow updates for RDS DB Instance 2015-11-11 09:36:37 -06:00
YuusukeMatsuura 7dd6b779ca Add AutoMinorVersionUpgrade to RDS. 2015-11-11 09:35:53 -06:00
Paul Stack e3a66d0928 Making engine_version be computed in the db_instance provider 2015-11-10 17:30:19 +00:00
stack72 1abb0b19bf Changing the db_instance resource to mark the engine_version as Optional 2015-11-10 17:30:09 +00:00
Clint 6492853e84 Merge pull request #3513 from iJoinSolutions/5873-terraform-snapshot-security-v6.3
Provider/aws Apply security group after restoring db_instance from snapshot
2015-11-02 15:06:02 -06:00
Michael Austin a0322f9b8c go fmt 2015-10-29 17:55:23 -04:00
Michael Austin 5448e01269 removed extraneous debug code and clarified INFO logging 2015-10-29 17:53:40 -04:00
clint shryock a273b9b93b provider/aws: Add configuration to copy tags to RDS Snapshots 2015-10-16 11:14:11 -05:00
Michael Austin 53e196eaed fix vet error 2015-10-15 12:55:33 -04:00
Michael Austin 1ff02d9f31 Merge commit '0c2f189d083e49b49747ce323702db1861cb2cbf' into 5873-terraform-snapshot-security-v6.3 2015-10-14 13:56:27 -04:00
Michael Austin 32d04797f9 update security group after restore from snapshot 2015-10-14 13:23:11 -04:00
Radek Simko f9efede852 gofmt files from recently merged PRs 2015-10-07 13:35:06 -07:00