As we've seen elsewhere, the SDK now wants nils instead of empty arrays
for collections
fixes#1696
thanks @jstremick for pointing me in the right direction
The upstream behavior here changed, and the request needs a `nil`
instead of an empty slice to indicate that we _don't_ want to filter on
Network ACL IDs.
fixes#1634
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.
(thanks to Cisco Cloud for their support)
If reading an S3 bucket's state, and that bucket has been deleted, don't
fail with a 404 error. Instead, update the state to reflect that the
bucket does not exist. Fixes#1574.
EIP with VPC only returns an allocationID. However, for standard we need
to lookup for PublicIP. When we use an example for standard EC2 instance
(here `t1.micro`):
```
resource "aws_instance" "example" {
ami = "ami-25773a24"
instance_type = "t1.micro"
}
resource "aws_eip" "ip" {
instance = "${aws_instance.example.id}"
}
```
then in this case, allocationID will be nil, but publicIP will be non
nil (which is used later for association the IP). So check for
allocationId only if it's of domain `VPC`.
* master: (511 commits)
Update CHANGELOG.md
core: avoid diff mismatch on NewRemoved fields during -/+
Update CHANGELOG.md
update CHANGELOG
Fix minor error in index/count docs
terraform: remove debug
terraform: when pruning destroy, only match exact nodes, or exact counts
up version for dev
update CHANGELOG
terraform: prune tainted destroys if no tainted in state [GH-1475]
update CHANGELOG
config/lang: support math on variables through implicits
update CHANGELOG
update cHANGELOG
update cHANGELOG
providers/aws: set id outside if/esle
providers/aws: set ID after creation
core: remove dead code from pre-deposed refactor
website: update LC docs to note name is optional
security_groups field expects a list of Security Group Group Names, not IDs
...
Fixes#1409
Resource set hash calculation is a bit of a devil's bargain when it
comes to optional, computed attributes.
If you omit the optional, computed attribute from the hash function,
changing it in an existing config is not properly detected.
If you include the optional, computed attribute in the hash and do not
specify a value for it in the config, then you'll end up with a
perpetual, unresolvable diff.
We'll need to think about how to get the best of both worlds, here, but
for now I'm switching us to the latter and documenting the fact that
changing these attributes requires manual `terraform taint` to apply.
These bugs were found by additional check added in #1443
* Reversed nil err check meant that block devices were broken :(
* Fixing the err check revealed a few missed pointer derefs
* Unlike instances, ephemeral block devices do come back in
`BlockDeviceMappings` from `DescribeLaunchConfigurations` calls, so
we need to recognize them and filter them properly. Even though
they're not set as computed, I'm doing a `d.Set` since it doesn't
hurt and it gives us the benefit of basic drift detection.
Route 53 records were silently erroring out when saving the records returned
from AWS, because they weren't being presented as an array of strings like we
expected.
Turns out AssociatePublicIPAddress was always being set, but the AWS
APIs don't like that when you're launching into EC2 Classic and return a
validation error at ASG launch time.
Fixes#1410
This removes `ForceNew` from `records` and `ttl`, and introduces a
`resourceAwsRoute53RecordUpdate` function. The `resourceAwsRoute53RecordUpdate`
falls through to the `resourceAwsRoute53RecordCreate` function, which utilizes
AWS `UPSERT` behavior and diffs for us.
`Name` and `Type` are used by AWS in the `UPSERT`, so only records with matching
`name` and `type` can be updated. Others are created as new, so we leave the
`ForceNew` behavior here.
These changes should fix#1367:
* `ebs_optimized` gets `Computed: true` and set from `Read`
* `ephemeral_block_device` loses `Computed: true`
* explicitly set `root_block_device` to empty from `Read`
While I was in there (tm):
* Send pointers to `d.Set` so we can use its internal nil check.
If a given resource does not define an `Update` function, then all of
its attributes must be specified as `ForceNew`, lest Applys fail with
"doesn't support update" like #1367.
This is something we can detect automatically, so this adds a check for
it when we validate provider implementations.
* upstream/master: (295 commits)
Update CHANGELOG.md
provider/aws: Allow DB Parameter group to change in RDS
return error if failed to set tags on Route 53 zone
core: [tests] fix order dependent test
Fix hashcode for ASG test
provider/aws: Fix issue with tainted ASG groups failing to re-create
Don't error when reading s3 bucket with no tags
Avoid panics when DBName is not set
Add floating IP association in aceptance tests
Use env var OS_POOL_NAME as default for pool attribute
providers/heroku: Add heroku-postgres to example
docs: resource addressing
providers/heroku: Document environment variables
providers/heroku: Add region to example
Bugfix on floating IP assignment
Update CHANGELOG.md
update CHANGELOG
website: note on docker
core: formalize resource addressing
core: fill out context tests for targeted ops
...
* master: (167 commits)
return error if failed to set tags on Route 53 zone
core: [tests] fix order dependent test
Fix hashcode for ASG test
provider/aws: Fix issue with tainted ASG groups failing to re-create
Don't error when reading s3 bucket with no tags
Avoid panics when DBName is not set
Add floating IP association in aceptance tests
Use env var OS_POOL_NAME as default for pool attribute
providers/heroku: Add heroku-postgres to example
docs: resource addressing
providers/heroku: Document environment variables
providers/heroku: Add region to example
Bugfix on floating IP assignment
Update CHANGELOG.md
update CHANGELOG
website: note on docker
core: formalize resource addressing
core: fill out context tests for targeted ops
core: docs for targeted operations
core: targeted operations
...
* upstream/master:
return error if failed to set tags on Route 53 zone
cleanups
provider/aws: Finish Tag support for Route 53 zone
provider/aws: Add tags to Route53 hosted zones
* master: (172 commits)
core: [tests] fix order dependent test
Fix hashcode for ASG test
provider/aws: Fix issue with tainted ASG groups failing to re-create
Don't error when reading s3 bucket with no tags
Avoid panics when DBName is not set
Add floating IP association in aceptance tests
Use env var OS_POOL_NAME as default for pool attribute
providers/heroku: Add heroku-postgres to example
docs: resource addressing
providers/heroku: Document environment variables
providers/heroku: Add region to example
Bugfix on floating IP assignment
Update CHANGELOG.md
update CHANGELOG
website: note on docker
core: formalize resource addressing
core: fill out context tests for targeted ops
core: docs for targeted operations
core: targeted operations
user_data support
...
* master: (172 commits)
core: [tests] fix order dependent test
Fix hashcode for ASG test
provider/aws: Fix issue with tainted ASG groups failing to re-create
Don't error when reading s3 bucket with no tags
Avoid panics when DBName is not set
Add floating IP association in aceptance tests
Use env var OS_POOL_NAME as default for pool attribute
providers/heroku: Add heroku-postgres to example
docs: resource addressing
providers/heroku: Document environment variables
providers/heroku: Add region to example
Bugfix on floating IP assignment
Update CHANGELOG.md
update CHANGELOG
website: note on docker
core: formalize resource addressing
core: fill out context tests for targeted ops
core: docs for targeted operations
core: targeted operations
user_data support
...
* d.Set has a pointer nil check we can lean on
* need to be a bit more conservative about nil checks on nested structs;
(this fixes the RDS acceptance tests)
/cc @fanhaf
s3.GetBucketTagging returns an error if there are no tags associated
with a bucket. Consequently, any configuration with a tagless s3 bucket
would fail with an error, "the TagSet does not exist".
Handle that error more appropriately, interpreting it as an empty set of
tags.
* f-aws-rds-tags:
fix index out of range error
fix formatting
upgrade VPC Ids and DB Subnet to be optionally computed
fix typo
provider/aws: Introduce IAM connection
* master:
provider/aws: Fix dependency violation when deleting Internet Gateways
command/remote-config: failing tests
update CHANGELOG
command/remote-config: do a pull with `terraform remote config`
command/remote-{pull,push}: colorize and show success output
command/remote-config: lowercase the type so that Atlas works, for example
command/remote-config: show flag parse errors
command/remote-config: remove weird error case that shows no error message
command: when setting up state, only write back if local is newer
* master: (66 commits)
provider/aws: Fix dependency violation when deleting Internet Gateways
command/remote-config: failing tests
update CHANGELOG
command/remote-config: do a pull with `terraform remote config`
command/remote-{pull,push}: colorize and show success output
command/remote-config: lowercase the type so that Atlas works, for example
command/remote-config: show flag parse errors
command/remote-config: remove weird error case that shows no error message
command: when setting up state, only write back if local is newer
minor code cleanups to get acceptance tests passing
update CHANGELOG
providers/digitalocean: add dot in GET response
providers/digitalocean: force fqdn in dns rr value
update CHANGELOG
small code cleanup
Add proper reading/updating of tags for S3
provider/aws: Add tags to S3
Documentation for ASG Tags added
Tags support added for AWS ASG
command/output: don't panic if no root module in state [GH-1263]
...
* master:
update CHANGELOG
providers/digitalocean: add dot in GET response
providers/digitalocean: force fqdn in dns rr value
update CHANGELOG
Add disk size to google_compute_instance disk blocks.
'project' should be set to the project's ID, not its name.
Don't error when enabling DNS hostnames in a VPC
Correct AWS VPC or route table read functions
Updates to GCE Instances and Instance Templates to allow for false values to be set for the auto_delete setting.
Update GCE Instance Template tests now that existing disk must exist prior to template creation.
Update Google API import to point to the new location.
add network field to the network_interface
I was working on building a validation to check the user-provided
"device_name" for "root_block_device" on AWS Instances, when I realized
that if I can check it, I might as well just derive it automatically!
So that's what we do here - when you customize the details of the root
block device, device name is just comes from the selected AMI.
The AWS API call ModifyVpcAttribute will allow only one attribute to be
modified at a time. Modifying both results in the error:
Fields for multiple attribute types specified: enableDnsHostnames, enableDnsSupport
Retructure the provider to honor this restriction.
Also, enable DNS support before attempting to enable DNS hostnames,
since the former is a prerequisite of the latter.
Additionally, fix what must have been a copy&paste error, setting
enable_dns_support to the value of enable_dns_hostnames.
If the state file contained a VPC or a route table which no longer
exists, Terraform would fail to create the correct plan, which is to
recreate them.
In the case of VPCs, this was due to incorrect error handling. The AWS
SDK returns a aws.APIError, not a *aws.APIError on error. When the VPC
no longer exists, upon attempting to refresh state Terraform would
simply exit with an error.
For route tables, the provider would recognize that the route table no
longer existed, but would not make the appropriate call to update the
state as such. Thus there'd be no crash, but also no plan to re-create
the route table.
Though not directly connected, trying to delete a subnet and security group in
parallel can cause a dependency violation from the subnet, claiming there are
dependencies.
This commit fixes that by allowing subnet deletion to tolerate failure with a
retry / refresh function.
Fixes#934
Instance block devices are now managed by three distinct sub-resources:
* `root_block_device` - introduced previously
* `ebs_block_device` - all additional ebs-backed volumes
* `ephemeral_block_device` - instance store / ephemeral devices
The AWS API support around BlockDeviceMapping is pretty confusing. It's
a single collection type that supports these three members each of which
has different fields and different behavior.
My biggest hiccup came from the fact that Instance Store volumes do not
show up in any response BlockDeviceMapping for any EC2 `Describe*` API
calls. They're only available from the instance meta-data service as
queried from inside the node.
This removes `block_device` altogether for a clean break from old
configs. New configs will need to sort their `block_device`
declarations into the three new types. The field has been marked
`Removed` to indicate this to users.
With the new block device format being introduced, we need to ensure
Terraform is able to properly read statefiles written in the old format.
So we use the new `helper/schema` facility of "state migrations" to
transform statefiles in the old format to something that the current
version of the schema can use.
Fixes#858
Fixes a bug in Route53 and wildcard entries. Refs #501.
Also fixes:
- an issue in the library where we don't fully wait for the results, because the
error code/condition changed with the migration to aws-sdk-go
- a limitation in the test, where we only consider the first record returned
* master:
provider/aws: Fix encoding bug with AWS Instance
minor style cleanups
Tags Schema
Added Tagging
Added vpc refactor in aws sdk go
Removed additional variable for print, added for debugging
Using hashicorp/aws-sdk-go
Changed things around as suggested by @catsby
Refactor with Acceptance Tests
VPC Refactor
First refactor
Added Connection to config
* master: (69 commits)
upgrade tests and remove ICMPTypeCode for now
helper/ssh: update import location
clean up
provider/aws: Convert AWS Network ACL to aws-sdk-go
Update website docs on AWS RDS encryption field
more test updates
provider/aws update Network ACL tests
code cleanup on subnet check
restore IOPS positioning
Code cleanup
Update CHANGELOG.md
Bugfix: Add tags on AWS IG creation, not just on update
fix nit-pick from go vet
remove duplicated function
provider/aws: Convert AWS Route Table Association to aws-sdk-go
Cleansup: Restore expandIPPerms, remove flattenIPPerms
clean up debug output to make go vet happy
providers/aws: Convert AWS VPC Peering to aws-sdk-go
provider/aws: Add env default for AWS_ACCOUNT_ID in VPC Peering connection
convert route table tests to aws-sdk-go
...
* master:
Code cleanup
Update CHANGELOG.md
fix nit-pick from go vet
remove duplicated function
provider/aws: Convert AWS Route Table Association to aws-sdk-go
Cleansup: Restore expandIPPerms, remove flattenIPPerms
clean up debug output to make go vet happy
providers/aws: Convert AWS VPC Peering to aws-sdk-go
provider/aws: Add env default for AWS_ACCOUNT_ID in VPC Peering connection
convert route table tests to aws-sdk-go
provider/aws: Convert AWS Route Table to aws-sdk-go
providers/aws: iops in root device skipped when output state
Give route table assoc it's own copy of this method for now
provider/aws: Convert Main Route Table assoc. to aws-sdk-go
aws/Route53 record creation timeout 10->30 mins
provider/aws: Convert AWS Security Group to aws-sdk-go
Fixing up the tests to make them pass correctly
Fixing a corner case while retrieving a template UUID
Adding tests and docs for the new VPN resources
Adding a few new resources
Removing `ForceNew` from `final_snapshot_identifier` - it's a parameter
that's _only_ passed during the DeleteDBInstance API call, so it's perfectly
valid to change the attribute for an existing DB Instance.
fixes#1138
This allows you to set lifecycle create_before_destroy = true
and fixes#532 as then we'll make a new launch config, change
the launch config on the ASG, and *then* delete the old launch
config.
Also tried adding tests which unfortunately don't seem to fail...
* master:
providers/aws: Convert Launch Configurations to awslabs/aws-sdk-go
update CHANGELOG
terraform: test post state update is called
command: StateHook for continous state updates
terraform: more state tests, fix a bug
state: deep copies are required
terraform: make DeepCopy public
state/remote: increment serial properly
state: only change serial if changed
terraform: call the EvalUpdateStateHook strategically
terraform: PostStateUpdate hook and EvalUpdateStateHook
- Remove check on password for AWS RDS Instance
- Update documentation on AWS RDS Instance regarding DB Security Groups
- Change error handling to check error code from AWS API [ci skip]
The `SourceDestCheck` attribute can only be changed via
`ModifyInstance`, so the AWS instance resource's `Create` function calls
out to `Update` before it returns to take care of applying
`source_dest_check` properly.
The `Update` function originally guarded against unnecessary API calls
with `GetOk`, which worked fine until #993 when we changed the `GetOk`
semantics to no longer distinguish between "configured and zero-value"
and "not configured".
I attempted in #1003 to fix this by switching to `HasChange` for the
guard, but this does not work in the `Create` case.
I played around with a few different ideas, none of which worked:
(a) Setting `Default: true` on `source_dest_check' has no effect
(b) Setting `Computed: true` on `source_dest_check' and adding a `d.Set`
call in the `Read` function (which will initially set the value to `true`
after instance creation). I really thought I could get this to work,
but it results in the following:
```go
d.Get('source_dest_check') // true
d.HasChange('source_dest_check') // false
d.GetChange('source_dest_check') // old: false, new: false
```
I couldn't figure out a way of coherently dealing with that result, so I
ended up throwing up my hands and giving up on the guard altogether.
We'll call `ModifyInstance` more than we have to, but this at least
yields expected behavior for both Creates and Updates.
Fixes#1020
library.
This commit updates the Route 53 Zone resource to use AWS Labs aws-sdk-go
library instead of mitchellh/goamz.
- hard code us-east-1 for Route53 region, since it's a global endpoint
- add some units test for CleanZoneID
Unfortunately, the acceptance tests here were improperly passing, and
allowing Subnet updates on ELBs is not as straightfoward as simply
removing `ForceNew`.
Subnets on ELBs need to be managed by two explicit API calls:
* `AttachLoadBalancerToSubnets` - http://bit.ly/elbattachsubnet
* `DetachLoadBalanceFromSubnets` - http://bit.ly/elbdetachsubnet
We'll need to circle back and use these APIs to explicitly add support.
This fixes the failure of `TestAccAWSELB_AddSubnet` by removing the
test.
This reverts commit 61e91017be, reversing
changes made to 49b3afe452.
Was relying on old behavior of GetOk and therefore never properly seeing
a change from true -> false.
This fixes the acceptance test failure of
`TestAccAWSInstance_sourceDestCheck`.
AWS provides a single `BlockDeviceMapping` to manage three different
kinds of block devices:
(a) The root volume
(b) Ephemeral storage
(c) Additional EBS volumes
Each of these types has slightly different semantics [1].
(a) The root volume is defined by the AMI; it can only be customized
with `volume_size`, `volume_type`, and `delete_on_termination`.
(b) Ephemeral storage is made available based on instance type [2]. It's
attached automatically if _no_ block device mappings are specified, and
must otherwise be defined with block device mapping entries that contain
only DeviceName set to a device like "/dev/sdX" and VirtualName set to
"ephemeralN".
(c) Additional EBS volumes are controlled by mappings that omit
`virtual_name` and can specify `volume_size`, `volume_type`,
`delete_on_termination`, `snapshot_id`, and `encryption`.
After deciding to ignore root block devices to fix#859, we had users
with configurations that were attempting to manage the root block device chime
in on #913.
Terraform does not have the primitives to be able to properly handle a
single collection of resources that is partially managed and partially
computed, so our strategy here is to break out logical sub-resources for
Terraform and hide the BlockDeviceMapping inside the provider
implementation.
Now (a) is supported by the `root_block_device` sub-resource, and (b)
and (c) are still both merged together under `block_device`, though I
have yet to see ephemeral block devices working properly.
Looking into possibly separating out `ephemeral_block_device` and
`ebs_block_device` sub-resources as well, which seem like the logical
next step. We'll wait until the next big release for this, though, since
it will break backcompat.
[1] http://bit.ly/ec2bdmap
[2] http://bit.ly/instancestorebytypeFixes#913
Refs #858