Commit Graph

2434 Commits

Author SHA1 Message Date
Andy Chan cd69404fbc Fixing the broken test 2016-04-29 10:11:42 -07:00
Paul Stack a9b738f00c provider/aws: Removal of duplicate error handling code in cloudwatch_log_group
cloudwatch_log_group
2016-04-28 13:12:47 +01:00
Paul Stack c12a31e1b0 provider/aws: Fix Read of AWS CloudWatch Log when Update was called (#6384)
Fixes #6169

The Update func was hitting a return err and when the err was empty, it
was skipping over the subsequent read func
2016-04-28 00:02:33 +01:00
Justin Nauman 495c4b3dbc provider/aws - CloudFront custom_error_response fixes for missing (#6382)
* provider/aws - CloudFront custom_error_response fixes for missing

- Omit custom_error_response response_* fields when not explicitly set via config for
SDK call
- Adding a test case to ensure that the response_error gets converted
to an empty string properly, versus "0". (Thanks @vancluever)

Fixes #6342

* - Fixing ACC test case resource names
2016-04-28 00:00:21 +01:00
Kraig Amador dd77bf68da Fixed up some confusion between AWS_TOKEN and AWS_PROFILE. Also allowing testing when AWS_PROFILE is set without AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID. 2016-04-27 14:18:20 -07:00
Paul Stack ee3d89a4cd provider/aws: refresh state on SQS Queue not found (#6381)
When an SQS queue was deleted from the AWS Console, an error was thrown
to say that the Queue could not be found. This is now fixed to remove
the queue from the state on a specific not found exception
2016-04-27 20:07:34 +01:00
Radek Simko 0a8ea049ef Merge pull request #5030 from TimeIncOSS/account_check
provider/aws: Allow account ID checks on EC2 instances & w/ federated accounts
2016-04-27 21:07:15 +02:00
Radek Simko 7642fa05a8 Merge pull request #5893 from TimeIncOSS/b-aws-api-gateway-fields
provider/aws: Respect 'selection_pattern' in api_gateway_integration_response
2016-04-27 20:46:29 +02:00
Paul Hinze de13281ee6 provider/aws: fix potential aws_route crash (#6338)
The "find route in table" helper code was not properly handling routes
with no destination CIDR block - like vpc_endpoint routes - so if one of
those routes would come up before the target route in the loop, we'd get
a crash.

Fixes #6337
2016-04-27 13:10:40 +01:00
Mike Ball 02bbe18635 comment grammar/spelling fix (#6373) 2016-04-27 13:10:05 +01:00
Radek Simko e3ade6a784 provider/aws: Add support for api_gateway_account (#6321) 2016-04-27 13:08:59 +01:00
Colin Hebert f1f602cdf6 aws: Enable account ID check for assumed roles + EC2 instances 2016-04-27 12:56:03 +02:00
Radek Simko d9f327c282 provider/aws: Read aws_api_gateway_integration_response fields back 2016-04-27 11:45:52 +02:00
Radek Simko 70242c2e6d provider/aws: Respect 'selection_pattern' in api_gateway_integration_response
- Fixes https://github.com/hashicorp/terraform/issues/5891
2016-04-27 11:45:52 +02:00
Radek Simko 5210e1127e provider/aws: Add regression test for #5891 2016-04-27 11:35:01 +02:00
David Harris 635fced8b4 provider/aws: Fixes issue where an update for an `aws_elastic_beanstalk_environment ` resource would ignore the `wait_for_ready_timeout` option. 2016-04-26 22:05:20 +01:00
David Harris 9ab2447b0b provider/aws: Elastic Beanstalk Environment update configuration template name changes (#6342)
* Updated `aws_elastic_beanstalk_environment` to update environment when the `template_name` attribute has a change. Consildated update functions to use a single update call and added state change conf to wait until environment is in a "Ready" state.

* Adding tests for `aws_elastic_beanstalk_configuration_template` use with the `aws_elastic_beanstalk_environment` resource.

* Verifies option settings from an `aws_elastic_beanstalk_configuration_template` resource are applied to the associated `aws_elastic_beanstalk_environment` resource
* Verifies updated name of an `aws_elastic_beanstalk_configuration_template` resource triggers an update for the associated `aws_elastic_beanstalk_environment` resource
* Verifies that option settings set in the `aws_elastic_beanstalk_environment` resource override settings in the `aws_elastic_beanstalk_configuration_template` resource
2016-04-26 11:15:46 +01:00
Paul Stack 2d2c0b2068 provider/aws: Fix `aws_redshift_cluster` number_of_nodes update (#6333)
Currently, the number of nodes was broken due to not passing the
node_type with the update. This PR adds the correct parameters and a
test to prove this works as expected
2016-04-25 23:00:57 +01:00
Paul Stack 5f874c9487 provider/aws: Extends the `aws_elasticache_cluster` validation (#6332)
The validation as part of #6330 was only for length. This PR adds the
rules for alphanumeric, not having -- within, not ending with a - and
that the id must start with a letter.

The PR also adds tests for these rules
2016-04-25 21:44:55 +01:00
lian a443144c89 provider-aws: validate cluster_id length for aws_elasticache_cluster (#6330) 2016-04-25 20:53:31 +01:00
clint shryock e138a0756b provider/aws: Use ID in lookup for AWS KMS Aliases 2016-04-25 10:54:26 -05:00
Radek Simko d31a6ac47f provider/aws: Add support for api_gateway_authorizer (#6320) 2016-04-25 12:22:37 +01:00
clint shryock 6cfb6c11b1 provider/aws: Use KMS ARN in S3 Bucket test 2016-04-22 15:10:34 -05:00
Clint 8f90078cd5 Merge pull request #6307 from hashicorp/b-aws-beanstalk-options-set-fix
provider/aws: Fix issue updating ElasticBeanstalk Configuraiton Templates
2016-04-22 12:07:06 -05:00
clint shryock 53988df7d1 provider/aws: Fix issue updating ElasticBeanstalk Configuraiton Templates 2016-04-22 12:06:40 -05:00
Mitchell Hashimoto d85df63526
providers/aws: aws_instance id-only 2016-04-22 09:37:41 -07:00
Cameron Stokes a7c24835d7 provider/aws: increase timeout for aws_redshift_cluster (#6305)
* provider/aws: increase timeout for aws_redshift_cluster

* provider/aws: increase timeout for redshift updates too
2016-04-22 10:42:22 -05:00
Mitchell Hashimoto dd402a3ba1
providers/aws: elb id-only 2016-04-21 22:26:52 -07:00
Mitchell Hashimoto c1509b0220
providers/aws: eip id-only 2016-04-21 22:17:14 -07:00
Mitchell Hashimoto f394ce1ef3
provider/aws: ebs_volume id-only tests 2016-04-21 21:49:17 -07:00
Mitchell Hashimoto f0511631bf
provider/aws: id-only refresh for autoscaling groups 2016-04-21 21:36:52 -07:00
Paul Stack 6ac312e682 provider/aws: Set the state of `cross_zone_load_balancing` during the read func (#6295)
Changes made manually to the ELB property were not being set and
Terraform was reporting now changes to infra was to be made on refresh
2016-04-22 01:47:19 +01:00
Paul Stack fb1a82dbd7 provider/aws: Refresh state on Directory Service not found (#6294)
When a directory service was not found, Terraform was panicking due to
`dir := out.DirectoryDescriptions[0]`. The AWS API doesn't throw an
Error in this case. IT just return s0 results. Therefore, we should
check for 0 results in the return and remove the directory from the
state
2016-04-22 01:13:04 +01:00
Mitchell Hashimoto 0083431077
provider/aws: fix name on id-only check 2016-04-21 13:58:56 -07:00
Mitchell Hashimoto f2d91f0c2b
providers/aws: route53_health_check id-only 2016-04-21 13:50:03 -07:00
Mitchell Hashimoto 2274bb8c4a
provider/aws: route53 record import 2016-04-21 13:50:03 -07:00
Mitchell Hashimoto 6f091efd9b
providers/aws: route53_zone fix importing id-only private zone 2016-04-21 13:50:03 -07:00
Justin Clark f430fe280a Fix issue with with Opsworks and empty Custom Cook Book sources (#6078)
* Remove computed value on opsworks update

* Adjust PR 6078 per catsby's request
2016-04-21 13:59:40 -05:00
Mitchell Hashimoto b1c215f5e2
providers/aws: route53_zone id-only refresh 2016-04-21 08:53:53 -07:00
Mitchell Hashimoto 8b4e98e732
providers/aws: some id-only work on s3 buckets more work needed 2016-04-21 08:44:45 -07:00
Mitchell Hashimoto 7292c9df25
providers/aws: remove the opt-out stuff for id-only 2016-04-21 08:37:08 -07:00
Mitchell Hashimoto 3a43ce8f8e
providers/aws: sns_topic id-only 2016-04-21 08:18:04 -07:00
Clint bc68dee2eb provider/aws: Fix crash in AWS S3 Bucket when website index/error is empty (#6269) 2016-04-21 08:07:01 -05:00
Mitchell Hashimoto 7878cf327f
providers/aws: aws_sqs_queue isn't going to work for id-only 2016-04-20 18:07:50 -07:00
Mitchell Hashimoto 3013d1d2d1
provider/aws: customer gateway has to parse bgn_asn as int 2016-04-20 17:59:19 -07:00
Mitchell Hashimoto 0722f0b138
provider/aws: aws_flow_log id-only 2016-04-20 17:45:57 -07:00
Mitchell Hashimoto 54e119d32d
provider/aws: internet gateway id-only 2016-04-20 17:38:04 -07:00
Mitchell Hashimoto 2754691d2e
providers/aws: nat gateway fixes for id only refresh 2016-04-20 17:36:16 -07:00
Mitchell Hashimoto 10e4147d00
providers/aws: nat gateway id-only 2016-04-20 17:16:37 -07:00
Mitchell Hashimoto fc07b6315c
providers/aws: network_acl id-only 2016-04-20 17:10:01 -07:00
Mitchell Hashimoto 6887aad1c2
providers/aws: eni id-only 2016-04-20 16:57:17 -07:00
Mitchell Hashimoto 87537ea605
providers/aws: route table id only 2016-04-20 16:48:43 -07:00
Mitchell Hashimoto c5c3de4f01
providers/aws: classic SG test should test classic 2016-04-20 16:44:57 -07:00
Mitchell Hashimoto a44c547986
providers/aws: security group id-only 2016-04-20 16:42:00 -07:00
Mitchell Hashimoto c682dece84
providers/aws/vpn_gateway id-only refresh 2016-04-20 12:41:20 -07:00
Mitchell Hashimoto 9e65c30707
providers/aws/vpn_connection id-only refresh 2016-04-20 12:41:20 -07:00
Mitchell Hashimoto 0f91b30f64
providers/aws/vpc_peering: don't run id-only on plan test 2016-04-20 12:21:08 -07:00
Mitchell Hashimoto ff7b58f032
providers/aws: peering connection id-only test settings 2016-04-20 12:19:21 -07:00
Mitchell Hashimoto 60103c083a
providers/aws: working on id-only tests, no bugs found in these
resources
2016-04-20 12:10:53 -07:00
Josh Myers 3be66aa9ed Add cloudwatch_logs_subscription_filter provider (#5996) 2016-04-20 20:05:21 +01:00
Mitchell Hashimoto 0ef1b3b84a
providers/aws: response value for DescribeVpcAttribute needs to be
.Value
2016-04-20 11:35:43 -07:00
Mitchell Hashimoto 35f4201b9e
providers/aws: instance_tenancy is computed, set 2016-04-20 10:48:22 -07:00
Mitchell Hashimoto cfa5a3fe58
Revert "providers/aws: vpc refresh sets instance_tenancy"
This reverts commit a6d9e343ec.
2016-04-20 10:38:48 -07:00
Mitchell Hashimoto a6d9e343ec
providers/aws: vpc refresh sets instance_tenancy 2016-04-20 10:36:28 -07:00
KOJIMA Kazunori 5e33517394 provider/aws: Add support S3 Object Lifecycle Rule (#6220)
* providers/aws: Add support S3 Object Lifecycle Rule

* Fix failed vet command

* Fix failed acceptance tests

* Check nil pointer before dereference.

* Move S3 lifecycle rule id validator func to validators.go

* Don't fail when get lifecycle rule's response code is 404
2016-04-20 11:16:14 +01:00
Rev. C. Bennett Hoffman e108275331 Use resource.Retry for route creation and deletion (#6225)
* Use resource.Retry for route creation and deletion

* Remove uneeded out var in resource_aws_route.go
2016-04-19 17:23:42 -05:00
Chris Marchesi 6ebac8403d provider/aws: CloudFront post-merge review updates (#6196)
* provider/aws: Fix hashing on CloudFront certificate parameters

Adding necessary type assertion to values on the viewer_certificate hash
function to ensure that certain fields are indeed not zero string
values, versus simply zero interface{} values (aka nil, as is such for a
map[string]interface{}).

* provider/aws: CloudFront complex structure error handling

Handle errors better on calls to d.Set() in the
aws_cloudfront_distribution, namely in flattenDistributionConfig(). Also
caught a bug in the setting of the origin attribute, was incorrectly
attempting to set origins.

* provider/aws: Pass pointers to set CloudFront primitives

Change a few d.Set() for primitives in aws_cloudfront_distribution and
aws_cloudfront_origin_access_identity to use the pointer versus a
dereference.

* docs: Fix CloudFront examples formatting

Ran each example thru terraform fmt to fix indentation.

* provider/aws: Remove delete retention on CloudFront tests

To play better with Travis and not bloat the test account with disabled
distributions.

Disable-only functionality has been retained - one can enable it with
the TF_TEST_CLOUDFRONT_RETAIN environment variable.

* provider/aws: CloudFront delete waiter error handling

The call to resourceAwsCloudFrontDistributionWaitUntilDeployed() on
deletion of CloudFront distributions was not trapping error messages,
causing issues with waiter failure.
2016-04-19 16:40:30 -05:00
Paul Stack 8335555636 Gofmt issues (#6246) 2016-04-19 20:41:26 +01:00
David Harris b78f4c1114 provider/aws: Added migration for `tier` attribute in aws_elastic_beanstalk_environment resource. (#6167)
Fixes #6164.
2016-04-19 20:32:49 +01:00
Justin Clark 8249cb10eb Resolves DefaultOS and ConfigurationManager conflict (#6244) 2016-04-19 19:59:03 +01:00
clint shryock 6a9400d10e provider/aws: Allow 'available' state when deleting RDS Clusters 2016-04-19 13:15:45 -05:00
Clint fcdcb4b916 provider/aws: Default Network ACL resource (#6165)
* provider/aws: Default Network ACL resource

Provides a resource to manage the default AWS Network ACL. VPC Only.

* Remove subnet_id update, mark as computed value. Remove extra tag update

* refactor default rule number to be a constant

* refactor revokeRulesForType to be revokeAllNetworkACLEntries

Refactor method to delete all network ACL entries, regardless of type. The
previous implementation was under the assumption that we may only eliminate some
rule types and possibly not others, so the split was necessary.

We're now removing them all, so the logic isn't necessary

Several doc and test cleanups are here as well

* smite subnet_id, improve docs
2016-04-18 11:02:00 -05:00
clint shryock a810edd7a6 provider/aws: Randomize DB Identifier in test
Getting name collisions every now and again
2016-04-18 10:00:59 -05:00
Martin Atkins e41616198f Don't read back opsworks stack cookbooks source password (#6203)
As with several other sensitive values in Opsworks, the API returns a
placeholder value rather than a nil. To avoid writing the placeholder
value into the state we just skip updating the password on read, letting
whatever value was in the state persist.

This means that Terraform can't detect configuration drift where someone
has changed the password via some other means, but Terraform will still
be able to recognize changes to the password made within Terraform itself
due to the "last-written" value in the state.

This fixes #6192.
2016-04-16 22:56:36 +01:00
Martin Atkins 94f338d5de Merge #4276: aws_opsworks_instance resource 2016-04-16 10:14:22 -07:00
Martin Atkins 64db0454b4 Merge #6049: In Opsworks Stacks, wait for IAM changes to settle 2016-04-16 09:54:20 -07:00
Martin Atkins 2d597f09a8 Fix aws_opsworks_application acctest by passing in stack name
Other separate changes to testAccOpsworksStackConfigNoVpcCreate caused
this to begin failing because it was attempting to create a stack with
an empty name.
2016-04-16 09:44:04 -07:00
Martin Atkins bb7b8d6550 Merge #4419: aws_opsworks_application resource 2016-04-16 09:28:12 -07:00
Martin Atkins 41c535dc68 Unconditionally set opsworks layer custom_json
Previously in Update we would only set req.CustomJson if a non-empty
value was provided in the config. It seems that the Opsworks API considers
a null CustomJson to mean "do not change" rather than "set to empty",
so we need to explicitly set the empty string in the request body in
order to successfully remove an already-configured custom JSON.
2016-04-16 09:18:47 -07:00
Martin Atkins 72f121aec1 Merge #4272: custom JSON for Opsworks layers 2016-04-16 08:48:36 -07:00
Clint 05decba135 provider/aws: Better randomize the CloudTrail tests (#6188) 2016-04-15 10:06:40 -05:00
Chris Marchesi a38ccbe074 CloudFront distribution and origin access identity support (#5221)
* CloudFront implementation v3

* Update tests

* Refactor - new resource: aws_cloudfront_distribution

 * Includes a complete re-write of the old aws_cloudfront_web_distribution
   resource to bring it to feature parity with API and CloudFormation.
 * Also includes the aws_cloudfront_origin_access_identity resource to generate
   origin access identities for use with S3.
2016-04-14 14:55:11 -05:00
Raymond Fallon eed8733ee3 provider/aws: Enhance Triggers for AWS CodeDeploy Event Notifications (#6168)
* Improve testing of CodeDeploy DeploymentGroup Trigger Configs

  - ensure updates to trigger_events are applied
  - assert changes to trigger_target_arn

* Retry CodeDeploy DeploymentGroup when Trigger Config SNS Topic is not available

  - increase retries from 2 => 5
2016-04-14 20:26:33 +01:00
clint shryock 2830558bc9 check resource data for base64 encoded string 2016-04-13 10:44:26 -05:00
Doug Neal 1c662c2bc4 [#4794] Don't Base64-encode EC2 userdata if it is already Base64 encoded (#6140)
* Don't Base64-encode EC2 userdata if it is already Base64 encoded

The user data may be Base64 encoded already - for example, if it has been
generated by a template_cloudinit_config resource.

* Add encoded user_data to aws_instance acceptance test
2016-04-13 10:20:20 -05:00
Carlos Sanchez 32bd25d743 Issue #2174 Check that InternetGateway exists before returning from creation (#6105)
* Issue #2174 Check that InternetGateway exists before returning from creation

Fix some random InvalidInternetGatewayID.NotFound errors

* Issue #2174 Reuse IGStateRefreshFunc

* Issue #2174 Need to wait for creation before setting tags
2016-04-13 09:28:17 -05:00
Radek Simko f6a21e7899 provider/aws: Read VPC ID for Lambda function back from API 2016-04-13 15:05:19 +01:00
Radek Simko 3f188d5d1b provider/aws: Improve test for VPC-based Lambda func 2016-04-13 15:05:19 +01:00
Raymond Fallon 0cd0a4ec9c provider/aws: Manage Triggers for AWS CodeDeploy Event Notifications (#5599)
* provider/aws: CodeDeploy Deployment Group Triggers

  - Create a Trigger to Send Notifications for AWS CodeDeploy Events
  - Update aws_codedeploy_deployment_group docs

* Refactor validateTriggerEvent function and test

  - also rename TestAccAWSCodeDeployDeploymentGroup_triggerConfiguration test

* Enhance existing Deployment Group integration tests

  - by using built in resource attribute helpers
  - these can get quite verbose and repetitive, so passing the resource to a function might be better
  - can't use these (yet) to assert trigger configuration state

* Unit tests for conversions between aws TriggerConfig and terraform resource schema

  - buildTriggerConfigs
  - triggerConfigsToMap
2016-04-11 19:42:21 +01:00
Clint 2ea8c64079 provider/aws: More randomization to our Acc tests (#6124)
* provider/aws: Add more Randomization to DB Parameter Group Tests, to avoid collisions

* provider/aws: Add more randomization to Autoscaling group tests
2016-04-11 12:06:28 -05:00
Hector Rivas Gandara 0fdf91661d provider/aws: normalize json policy for sns topic policy attribute (#6089)
* provider/aws: test empty plan with sns_topic policy with random order

If we setup a sns_topic policy with a policy with a different order
to the one set by the AWS API, terraform plan will be not empty between
runs.

* provider/aws: normalize json policy for sns topic

For the policy attribute of the resource aws_sns_topic,  AWS returns the policy
in JSON format with the fields in a different order.
If we store and compare the values without normalizing, terraform
will unnecesary trigger and update of the resource.

To avoid that, we must add a normalization function in the StateFunc of
the policy attribute and also when we read the attribute from AWS.
2016-04-08 13:55:49 -05:00
Jan Nabbefeld 6bf9f21c39 Opsworks Application support 2016-04-07 14:18:50 -07:00
Paul Hinze 8380a7b03e provider/aws: Allow multiple EIPs to associate to single ENI
When calling AssociateAddress, the PrivateIpAddress parameter must be
used to select which private IP the EIP should associate with, otherwise
the EIP always associates with the _first_ private IP.

Without this parameter, multiple EIPs couldn't be assigned to a single
ENI. Includes covering test and docs update.

Fixes #2997
2016-04-07 13:26:15 -05:00
Jeff Tang be0ebbc22e Handle race condition with IAM role permissions 2016-04-06 16:04:25 -04:00
David Harris e698822be5 provider/aws: Renaming `option_settings` attribute to `setting`. Added test to verify that settings are applied to template.
Fixes #6035
2016-04-06 11:35:07 -05:00
Martin Atkins f739ef9849 Human-readable error for failure to read EC2 volume
Previously the format string was using %#v, which prints the whole data structure given.

Instead we want to use %s to get the string representation of the error.

This fixes #6038.
2016-04-06 09:34:10 -07:00
Hector Rivas Gandara eb4fef1ca1 aws provider: normalize json of cloudwatch event_pattern
Normalise the event_pattern of the aws_cloudwatch_event_rule resource

before uploading it to AWS.



AWS seems to accept a event_pattern with a JSON with new lines, but then

the rule does not seem to work. Creating the rule in the AWS console works,

but will setup the pattern  as a json without newlines or spaces, and

display a formatted JSON.
2016-04-05 15:56:45 -05:00
Clint 6f4dc98354 provider/aws: Remove CloudTrail Trail from state if not found 2016-04-05 14:04:00 -05:00
Jeff Tang b857bd1ce9 add TestCheckExists/TestCheckAttributes for opsworks instance 2016-04-05 13:44:48 -04:00
Clint 053ba9005d provider/aws: Remove Network ACL from state if not found 2016-04-05 11:11:16 -05:00