Commit Graph

752 Commits

Author SHA1 Message Date
Dave Cunningham b385093502 Deprecated 'network', introduce 'network_interface' 2015-02-06 03:21:22 -05:00
Paul Hinze c21907850d Merge pull request #921 from hashicorp/fix-diffreader-map-handling
helper/schema: fix DiffFieldReader map handling
2015-02-04 10:06:13 -06:00
Paul Hinze 926effb800 providers/aws: read ASG termination policies
Right now we yield a perpetual diff on ASGs because we're not reading
termination policies back out in the provider.

This depends on https://github.com/mitchellh/goamz/pull/218 and fixes
it.
2015-02-04 10:00:03 -06:00
Paul Hinze 219aa3e788 helper/schema: fix DiffFieldReader map handling
An `InstanceDiff` will include `ResourceAttrDiff` entries for the
"length" / `#` field of maps. This makes sense, since for something like
`terraform plan` it's useful to see when counts are changing.

The `DiffFieldReader` was not taking these entries into account when
reading maps out, and was therefore incorrectly returning maps that
included an extra `'#'` field, which was causing all sorts of havoc
for providers (extra tags on AWS instances, broken google compute
instance launch, possibly others).

 * fixes #914 - extra tags on AWS instances
 * fixes #883 - general core issue sprouted from #757
 * removes the hack+TODO from #757
2015-02-03 20:17:57 -06:00
Paul Hinze 80c5971fd6 Merge pull request #918 from hashicorp/f-aws-main-route-table-association
provider/aws: aws_main_route_table_association
2015-02-03 16:42:13 -06:00
Paul Hinze c6ab3b1711 Merge pull request #906 from BashtonLtd/gce_instance_selflink
Expose SelfLink field for GCE instances.
2015-02-03 15:46:46 -06:00
Dave Cunningham a07ff4bacb Remove service_accounts (legacy dupe of service_account) 2015-02-03 16:16:41 -05:00
Paul Hinze 92335b742a provider/aws: aws_main_route_table_association
This resource allows an existing Route Table to be assigned as the
"main" Route Table of a VPC. This means that the Route Table will be
used for any subnets within the VPC without an explicit Route Table
assigned [1].

This is particularly useful in getting an Internet Gateway in place as
the default for a VPC, since the automatically created Main Route Table
does not have one [2].

Note that this resource is an abstraction over an association and does not
map directly to a CRUD-able object in AWS. In order to retain a coherent
"Delete" operation for this resource, we remember the ID of the AWS-created
Route Table and reset the VPC's main Route Table to it when this
resource is deleted.

refs #843, #748

[1] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#RouteTableDetails
[2] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Internet_Gateway.html#Add_IGW_Routing
2015-02-03 13:47:43 -06:00
Greg Osuri 04ac1ffd02 provider/aws: fix for #915 - aws_elb.health_check attributes does not update during update 2015-02-02 19:25:54 -08:00
David Watson 4ec0c34794 Expose SelfLink for GCE instances to allow other resources to reference instances. 2015-02-02 09:46:35 +00:00
Paul Hinze 6da9f04c10 fix build: upstream azure client change
looks like https://github.com/MSOpenTech/azure-sdk-for-go/pull/30
changed the API for hosted services, which broke our build.
2015-02-01 10:35:33 -06:00
Paul Hinze 255d39b01b Merge pull request #898 from bitglue/subnet_update
Avoid unnecessary updating of aws_subnet
2015-02-01 10:01:17 -06:00
Paul Hinze 44759903fa Merge pull request #895 from hashicorp/588-gcp-improvements
Multiple gcp improvements and new resources
2015-01-30 16:49:22 -06:00
Dave Cunningham 12db8bc9d3 Merge branch 'master' into oauth2 2015-01-30 17:48:49 -05:00
Ferran Rodenas f561e2a6a8 Add Azure provider 2015-01-30 16:32:35 -06:00
Dave Cunningham aa009516b7 Port to oauth2, fix #606 2015-01-30 14:53:09 -05:00
Phil Frost 863fd0c7d2 Avoid unnecessary updating of aws_subnet
If map_public_ip_on_launch was not specified, AWS picks a default of
"0", which is different than the "" in the state file, triggerinng an
update each time. Mark that parameter as Computed, avoiding the update.
2015-01-30 13:17:16 -05:00
Phil Frost 8eb5418c4a Implement apply_method for RDS parameters
This is necessary to support creating parameter groups with parameters
that require a reboot, since the RDS API will return an error when
attempting to set those parameters with ApplyMethod "immediate".
2015-01-30 13:06:15 -05:00
Phil Frost bfaf8ccee6 Support storage_type parameter for aws_db_instance
This allows provisioning "gp2" (general purpose SSD) storage for DB
instances.
2015-01-30 13:01:10 -05:00
Dave Cunningham 6046647f38 Multiple gcp improvements and new resources 2015-01-30 10:32:35 -06:00
Dave Cunningham e85c7113fa Allow specifying project or full URL when specifying image 2015-01-29 20:00:02 -05:00
Phil Frost 04e86697fb Fix error when refreshing on a deleted AWS subnet
If a subnet exists in the state file and a refresh is performed, the
read function for subnets would return an error. Now it updates the
state to indicate that the subnet no longer exists, so Terraform can
plan to recreate it.
2015-01-29 11:06:40 -05:00
Paul Hinze 24c3718ac6 Merge pull request #884 from hashicorp/452-google-secrets-file
[REPACK] #452 providers/google: remove deprecated client secrets file
2015-01-28 17:21:11 -06:00
Paul Hinze 9fff0b1729 providers/google: fix instance creation
with this commit, the google compute instance acceptance tests are
passing

 - remove GOOGLE_CLIENT_FILE requirement from provider tests to finish
   out #452
 - skip extra "#" key that shows up in metadata maps, fixes #757 and
   sprouts #883 to figure out core issue
 - more verbose variablenames in metadata parsing, since it took me
   awhile to grok and i thought there might have been a shadowing bug in
   there for a minute. maybe someday when i'm a golang master i'll be
   smart enough to be comfortable with one-char varnames. :)
2015-01-28 15:50:56 -06:00
stungtoat d3814d6180 providers/google: remove secrets file
fixes #452
2015-01-28 15:47:49 -06:00
Phil Frost 254b25a64f Fix aws_db_instance to not recreate each time
Several of the arguments were optional, and if omitted, they are
calculated. Mark them as such in the schema to avoid triggering an
update.

Go back to storing the password in the state file. Without doing so,
there's no way for Terraform to know the password has changed. It should
be hashed, but then interpolating the password yields a hash instead of
the password.

Make the `name` parameter optional. It's not required in any engine, and
in some (MS SQL Server) it's not allowed at all.

Drop the `skip_final_snapshot` argument. If `final_snapshot_identifier`
isn't specified, then don't make a final snapshot. As things were, it
was possible to create a resource with neither of these arguments
specified which would later fail when it was to be deleted since the RDS
API requires exactly one of the two.

Resolves issue #689.
2015-01-28 12:03:26 -05:00
Paul Hinze 3cb5ba01a7 whitespace: fix mixed case indent 2015-01-28 05:16:04 -06:00
Paul Hinze c88c4a33e1 providers/aws: ignore ec2 root devices
fixes #859

EC2 root block devices are attached automatically at launch [1] and show
up in DescribeInstances responses from then on. By skipping these when
recording state, Terraform can avoid thinking there should be block
device changes when there are none.

Note this requires that https://github.com/mitchellh/goamz/pull/214 land
first so the proper field is exposed.

[1] http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html
2015-01-28 05:14:21 -06:00
Seth Vargo 918ba4c3be Merge pull request #851 from hashicorp/sethvargo/aws_envvars
Use standard AWS environment variables
2015-01-25 13:29:32 -05:00
Sander van Harmelen a3ef8bed68 Merge pull request #849 from gfloyd/spot-price
Add spot_price parameter to aws_launch_configuration resource
2015-01-23 23:48:09 +01:00
Graham Floyd 91378ce0af Add test for launch configuration with spot price 2015-01-23 15:51:25 -06:00
nevins-b 47b244d296 adding support for egress rules in AWS Security Groups 2015-01-23 09:46:20 -05:00
Seth Vargo 072a1cf353 Read the "standard" AWS environment variables
This is 100% backwards-compatible
2015-01-22 16:09:25 -05:00
Evan Krall 090a30e988 Fix comment in consul provider to not mention digitalocean 2015-01-22 12:45:55 -08:00
Graham Floyd c9a0627f13 Add spot_price parameter to aws_launch_configuration resource 2015-01-21 22:48:04 -06:00
Otto Jongerius 7759a28e9c No longer needed after merging of PR 804. 2015-01-21 18:48:28 +11:00
Armon Dadgar df71834ff7 Merge pull request #831 from gulyasm/log-typo
Fixed wrong cross zone balancing error log.
2015-01-20 13:20:25 -08:00
gulyasm 0486dd0624 Fixed wrong cross zone balancing error log.
If updating the cross zone balancing in the aws elb resource fails, the
error log claimed that the health check configuration failed. Fixed.
2015-01-17 16:20:35 +01:00
Jeff Mitchell f2bd1f45ab Move duplicated envDefaultFunc out of each provider and into Schema. 2015-01-16 17:25:39 +00:00
Sander van Harmelen 8e7ffc24a5 Merge pull request #823 from svanharmelen/f-provider/cloudstack-managed-fw
provider/cloudstack: managed fw and adding/updating docs
2015-01-16 17:53:42 +01:00
Mitchell Hashimoto 61e91017be Merge pull request #804 from PeoplePerHour/f-aws-elb-subnet
providers/aws: elb subnet change should not force a new resource
2015-01-16 08:33:32 -08:00
Panagiotis Moustafellos a49f1b5dd8 epic typo 2015-01-16 16:07:55 +02:00
Sander van Harmelen 8f223c020b Extending the managed firewall option
It’s now also possible to don’t give any rules, when the firewall is
configured with `managed = true`. This will in effect mean; make sure
no rules exist at all for the firewall.
2015-01-16 13:26:43 +01:00
Sander van Harmelen ab8977eed6 Last tweaks needed to get through all acc tests
Needed to tweak a few things in order get all tests running OK and to
be able to handle the latest changes in master. All is good again now…
2015-01-15 21:46:06 +01:00
Panagiotis Moustafellos cedf3a9415 providers/aws: elb subnet change acceptance test
add listeners

add orig subnet
2015-01-15 16:02:47 +02:00
Sander van Harmelen 19776ba402 Updating some logic and tests
These fixes are needed to make the provider work with master again.
These are still some issues, but they seem not to be related to the
provider, but the changes in `helper/schema`.
2015-01-15 11:29:04 +01:00
Sander van Harmelen 3898098c78 Adding the ability to manage the whole firewall
This goes for the normal firewall, the egress firewall and the network
ACL.

USE WITH CAUTION! When setting `managed = true` in your config, it
means it will delete all firewall rules that are not in your config, so
unknown to TF.

Also adding the new `cloudstack_egress_firewall` resource with this
commit and updating go-cloudstack to the latest API version (v4.4)
2015-01-15 10:04:09 +01:00
Panagiotis Moustafellos c963793f3d providers/aws: elb subnet change should not force a new resource 2015-01-15 10:43:26 +02:00
Emil Hessman 335d8fa1e6 builtin/providers/cloudstack: fix err checks in tests
Wrong return value is used to determine if an error occured.
Make sure to check the actual Error value that the functions return.
2015-01-14 19:54:29 +01:00
Sander van Harmelen fa1b3c88d8 Fix conversion error
This causes a crash of the provider
2015-01-13 08:55:47 +01:00
Sander van Harmelen 7b16c44cc2 provider/cloudstack: make timeout configurable
Seems some platforms need more time, so make it configurable with a
sane default…
2015-01-12 15:57:24 +01:00
Sander van Harmelen 9cf0c44247 provider/cloudstack: fixing the cloudstack_disk provider
This value is read back from the environment to the state, without
setting this to `Computed: true` it will see the read back value as a
diff.
2015-01-12 15:04:58 +01:00
Mitchell Hashimoto 08813e6571 Merge branch 'add-ig-tags' of https://github.com/robzienert/terraform into robzienert-add-ig-tags
Conflicts:
	builtin/providers/aws/resource_aws_internet_gateway_test.go
2015-01-10 15:28:14 -08:00
Paul Hinze f800441fe1 provider/aws: fix aws_db_instance acceptance tests
- 5.6.17 is no longer a valid mysql engine version, bumping to 5.6.21
- updating security_group_names assertion to match new set structure
  introduce in #663
2015-01-10 15:55:08 -06:00
Ryan Uber 94c3acbca6 Switch to github.com/hashicorp/consul/api 2015-01-06 17:11:29 -08:00
Mitchell Hashimoto cc0ee4a6bb Merge pull request #731 from atlassian/tags
providers/aws: make tags not computed
2015-01-06 15:38:35 -08:00
Armon Dadgar eef75a7a2a Merge pull request #695 from moredip/aws_key_pair-resource
add aws_key_pair resource
2015-01-06 10:46:58 -08:00
Armon Dadgar 0ffc11c885 Merge pull request #704 from yahyapo/master
[AWS] Adding default network ACL ID and default security group ID to VPC reference attributes
2015-01-06 10:29:16 -08:00
Armon Dadgar 11dc775c25 Merge pull request #701 from ceh/issue-687
builtin/providers/aws: acceptance tests for assigning private IPs on AWS instance
2015-01-05 11:41:15 -08:00
Armon Dadgar 34d5464c63 Merge pull request #725 from jgoldschrafe/feature-google-compute-service-accounts
Support service accounts on GCE instances
2015-01-05 11:30:38 -08:00
Armon Dadgar 150da4720f Merge pull request #724 from frodenas/google_ubuntu_images
provider/google: Add Ubuntu images
2015-01-05 11:27:07 -08:00
Sander van Harmelen 54ab857a54 Merge pull request #728 from atlassian/route_diff_fix
Route diff fix
2015-01-05 10:43:02 +01:00
Sander van Harmelen 7106917e98 Merge pull request #726 from atlassian/vgw_routes
Vgw routes
2015-01-05 10:39:42 +01:00
Emil Hessman c738bf0477 builtin/providers/aws: remove unreachable code and skip unnecessary remote call
When DeleteInternetGateway is successful it returns a nil error value.
However, for a nil error value, the RetryFunc returns an error yielding a
unnecessary second call to DeleteInternetGateway in the retry logic.

The logic works because DeleteInternetGateway eventually returns an ec2.Error
with error code InvalidInternetGatewayID.NotFound since the internet gateway
has been deleted in the previous call. The return value of nil breaks the
retry logic and the deletion is deemed successful.

Fix the unnecessary second call to DeleteInternetGateway by short circuiting
with a nil error value when deletion of the internet gateway is successful on
the first try.

Add an acceptance test for internet gateway deletion and remove unreachable
code while here.
2015-01-03 21:56:44 +01:00
Otto Jongerius eb1776c7e3 "Computed" should be false 2015-01-03 18:33:18 +11:00
Otto Jongerius 66159fd008 ignore routes originating from vgws 2015-01-02 19:17:52 +11:00
Otto Jongerius f6385215f6 Merge branch 'master' into route_diff_fix 2015-01-02 19:08:53 +11:00
Otto Jongerius 9bdb2fb2d1 This change belongs in a branch 2015-01-02 19:08:33 +11:00
Otto Jongerius 19c6d04928 Do store potentially empty values. Failing to do so will generate different hashes for identical route(s). 2015-01-02 19:03:13 +11:00
Jeff Goldschrafe d3081e0da8 Support service accounts on GCE instances
Update the Google Compute Engine provider to add support for service
accounts on `google_compute_instance`. Both gcloud shorthand (`compute-ro`,
`storage-ro`, etc.) and OAuth2 API endpoints are supported.

This feature is currently limited to a single service account (supporting
multiple scopes) and an automatically-generated service account email.
2015-01-02 01:25:19 -05:00
Ferran Rodenas fc0902d230 provider/google: Add Ubuntu images
Ubuntu images are now GA, so add them to the list of available public images
2014-12-31 03:16:52 -08:00
Otto Jongerius 639e0c72b4 ignore routes originating from vgws 2014-12-31 10:23:34 +11:00
Rob Zienert 186af0bbb3 Changing AWS ELB to not ForceNew when listeners change 2014-12-27 22:33:33 -06:00
Rob Zienert 9fd59f09e2 Adding tags support to Internet Gateway resource 2014-12-27 22:05:15 -06:00
Sander van Harmelen 852e2f74ca Fixing aws_elb schema
If not suppling the `availability_zones`, they will be computed
(meaning an update/refresh will retrieve the info and update the values
to the state file).

So without the `Computed = true` the diff will always flag this as a
change, even when it’s not.
2014-12-25 23:12:54 +01:00
Sander van Harmelen 72fa547557 Making things consistent throughout the provider 2014-12-25 22:58:17 +01:00
Sander van Harmelen 57ae6a5da6 Fixing aws_instance schema
Some instance types have a block device by default. So when selecting
such an instance type, you will not set a config for the block device,
but the update/refresh func will notice one and update the state
nonetheless.

So in those cases the `block_device` becomes a `computed` field.
2014-12-25 21:58:26 +01:00
Sander van Harmelen b96f373ee9 Fixing some logic issues with the aws-instance resource
1. The schema contained a few fields that where not marked as
`computed`, while they were updated inside the resource.

2. While updating the `volume_size` it was doing so with a `string`,
but in the schema this field is set as `int`.

3. The set func for calculating the hashes for the `block` set items,
also used computed values to calculate the hash. As these values will
not be in the config, but only in the state, this will always show as a
diff. The solution is to only use the fields that aren’t computed in
order to get consistent hashes.

These where all issues before, but weren’t visible as such. All should
be good again now.
2014-12-25 18:21:05 +01:00
Yahya Poonawala 7860dc1ef6 Adding default security group id attribute reference on creation of VPC. Fixes issue #466. 2014-12-23 11:43:33 +05:30
Yahya Poonawala 634984532d Adding default network acl id attribute reference on creation of VPC. Fixes issue #466. 2014-12-22 23:08:15 +05:30
Emil Hessman 13f1f1f9ad builtin/providers/aws: acceptance tests for assigning private IPs on AWS instance 2014-12-20 20:48:07 +01:00
Sander van Harmelen fd6382fbaf Merge pull request #699 from svanharmelen/f-provider/cloudstack-small-fix
provider/cloudstack: changing this fixes an Excoscale issue where 'all' is not allowed
2014-12-19 19:21:47 +01:00
Sander van Harmelen bb3bbcc0fc Changing this fixes an Excoscale issue where 'all' is not allowed 2014-12-19 19:14:46 +01:00
Pete Hodgson 5b66b9306e add aws_key_pair resource
For now this only supports importing a key pair (by specifying a
public_key) property. In the future it'd be fairly trivial to support
key pair creation, with the private key returned as a computed property.

In real world usage you'd probably want to provide that public_key
property via a variable rather than hard-coding it into a terraform
config that'd end up in source control.
2014-12-18 01:27:06 -08:00
Sander van Harmelen b58e468033 Updated the security_group attribute to use a set
This way the order returned by the API has no impact on the saved
state, preventing false positives when diffing.
2014-12-17 23:53:01 +01:00
Emil Hessman 68a41035a9 builtin/providers/mailgun: vet fix
Fixes the following vet report:

builtin/providers/mailgun/resource_mailgun_domain_test.go:73: arg DomainResp.Domain.Wildcard for printf verb %s of wrong type: bool
2014-12-17 12:59:07 +01:00
Emil Hessman 7b704fb77d builtin/providers/heroku: vet fix
Fixes the following vet reports:

builtin/providers/heroku/resource_heroku_app.go:192: arg vs for printf verb %s of wrong type: bool
builtin/providers/heroku/resource_heroku_app.go:198: arg vs for printf verb %s of wrong type: bool
2014-12-17 12:58:12 +01:00
Emil Hessman 4f3f85b165 builtin/providers/aws: vet fix
Fixes the following vet reports:

builtin/providers/aws/resource_aws_network_acl.go:191: wrong number of args for format in Errorf call: 2 needed but 3 args
builtin/providers/aws/resource_aws_network_acl.go:264: wrong number of args for format in Errorf call: 1 needed but 2 args
builtin/providers/aws/resource_aws_network_acl.go:268: wrong number of args for format in Errorf call: 1 needed but 2 args
builtin/providers/aws/resource_aws_network_acl.go:286: arg m[to_port].(int) for printf verb %s of wrong type: int
builtin/providers/aws/resource_aws_network_acl_test.go:277: arg r.NetworkAcls for printf verb %s of wrong type: []github.com/mitchellh/goamz/ec2.NetworkAcl
builtin/providers/aws/resource_aws_subnet_test.go:21: arg v.MapPublicIpOnLaunch for printf verb %s of wrong type: bool
2014-12-17 12:37:46 +01:00
Emil Hessman 95fa353ee9 builtin/providers/atlas: vet fix
Fixes the following vet report:

builtin/providers/atlas/resource_artifact.go:139: arg user for printf verb %d of wrong type: string
2014-12-17 12:28:28 +01:00
Sander van Harmelen 9797881ed8 Updating the tests and refactoring the code a little
There was an error in the goamz package the prevented updating the
availability zones correctly. So PR #181 should be merged before this
one can be merged…
2014-12-16 15:21:25 +01:00
Sander van Harmelen 3aeba87e38 Updating the resource to use a set instead of a list
By using a set for the availability zones, you can use things like
`availability_zones = ["${aws_instance.web.*.availability_zone}"]`
where is very likely multiple of the same zones will be added to the
set. If you use a list here, the list will say it’s changed (even if
you add the same zone) which will force a new resource.
2014-12-16 13:13:59 +01:00
Sander van Harmelen 7e091dd7bd Merge pull request #677 from svanharmelen/f-provider-aws-fix-route53-toggling
provider/aws: fixing the flipflop problem for the aws_route53 resource
2014-12-16 11:22:54 +01:00
Sander van Harmelen a7667986f9 Updated the code so it makes use of the available functionality
The `helper/schema` package already knows how to create a set from a
slice with set items. So let’s use that functionality…
2014-12-16 11:14:33 +01:00
Mitchell Hashimoto 4f70630c52 Merge pull request #525 from pmoust/patch-2
provider/aws: update to support more regions
2014-12-15 16:40:35 -08:00
Sander van Harmelen 43a30e7d13 Finishing up the needed changes
Also executed the acceptance tests successfully now.
2014-12-16 00:59:47 +01:00
Sander van Harmelen ee7b33acf4 Fixing the flipflop problem
Actually meant as a PoC, but it works perfectly so let’s just merge
this…
2014-12-16 00:40:43 +01:00
Mitchell Hashimoto 6a663796d5 Merge pull request #663 from svanharmelen/f-fix/change-set-logic
core: refactoring the way sets work internally v2
2014-12-15 13:38:00 -08:00
Armon Dadgar f923368fc5 Merge pull request #672 from plan3-labs/heroku_cert_support
Heroku SSL certificate support
2014-12-15 12:12:57 -08:00
Sander van Harmelen 9f0c8874b9 Merge pull request #674 from svanharmelen/f-make-func-names-consistent
Making all function names consistent
2014-12-15 15:57:02 +01:00
Sander van Harmelen 4ace4865d7 Making all function names consistent
Before all providers were using the helper.Schema approach the helper
function had these names. Now they all use names consistent with the Go
naming conventions except for these last few…
2014-12-15 15:26:17 +01:00