Skip to content

Commit

Permalink
Update from terraform master (#13)
Browse files Browse the repository at this point in the history
* Add Data Source: aws_elb

* Fix dataSourceAwsElb typo

* Fix dataSourceAwsElb Schema name field to not include Computed

* Remove dataSourceAwsElb schema defaults for computed fields

* Remove dataSourceAwsElb schema defaults for nested computed fields too

* Corrected depends_on entry for EIP

  depends_on                = ["aws_internet_gateway.gw"] is the correct syntax

* Add sweeper for IAM Server Certificates

* test/aws_config_delivery_channel: Add missing dependencies

* d/aws_elb r/aws_elb: hashicorp#2004 review comments

* Remove enable_deletion_protection from testAccDataSourceAWSELBConfigBasic
* Replace unnecessary errwrap.Wrapf with fmt.Errorf
* Reduce flattenAwsELbResource to ec2conn and elbconn instead of meta
* Properly name TestAccDataSourceAWSELB_basic resources
* Use t.Name() for description and TestName tags

* d/aws_elb: Fix documentation sidebar ordering after merging master with new d/aws_elasticache_replication_group

* Makefile: Add sweep target

* Update cognito_user_pool.markdown

* Update CHANGELOG.md

* r/aws_elasticache_security_group: add import support (hashicorp#2277)

* r/aws_elasticache_security_group: add import support

* r/aws_elasticache_security_group: hashicorp#2277 review updates

* Use d.Id() instead of d.Get("name") on read, which allows using schema.ImportStatePassthrough
* d.Set("security_group_names") on read
* Set AWS_DEFAULT_REGION to us-east-1 on import testing

* Update CHANGELOG.md

* documentation: remove antislashes in page titles

* Added missing WARN debug lines when reading a non-existing resource

* Removed <wbr> from documentation titles

* vendor: Bump aws-sdk-go to v.1.12.44

* Add logs for iam server certificate delete conflict (hashicorp#2533)

* Query elb API for load balancer arn causing delete conflict

- For IAM server certificate.

* Use regex for lb name.

* Edits for hashicorp#2533

* r/aws_sqs_queue_policy: Support import by queue URL (hashicorp#2544)

* Update CHANGELOG.md

* r/aws_elasticsearch_domain: Add LogPublishingOption (hashicorp#2285)

* WIP

* Add enabled

* Use cwl policy

* Reflect reviews

* Update CHANGELOG.md

* Add force_destroy field to aws_athena_database (hashicorp#2363)

* Add force_destroy field to aws_athena_database.

Fixes hashicorp#2362.

* Remove unnecessary import.

* Code review feedback

* Update CHANGELOG.md

* Add more example and missing field

* New Resource: aws_media_store_container (hashicorp#2448)

* New Resource: aws_media_store_container

* Reflect reviews

* remove policy

* Update CHANGELOG.md

* Add Redis AUTH, in-transit and at-rest encryption (hashicorp#2090)

* add AUTH, at-rest and in-transit encryption to Elasticache replication groups

* add _enabled to transit/at_rest encyrption parameters

* added one more _enabled

* move validateAwsElastiCacheReplicationGroupAuthToken to aws/validators.go, as well as tests

* set auth_token to nil during Reads

* update Replication Group encryption acceptance tests to use config functions instead of vars

* Fix whitespacing (tabs -> spaces)

* docs/elasticache_replication_group: Add missing fields

* Update CHANGELOG.md

* r/aws_dynamodb_table: Ensure ttl is properly read (hashicorp#2452)

* r/aws_dynamodb_table: Ensure ttl is properly read

* r/aws_dynamodb_table: hashicorp#2452 review updates

* Add timeToLiveOutput.TimeToLiveDescription nil check
* Simplify logic to d.Set ttl

* Update CHANGELOG.md

* Bump aws-sdk-go to v.1.12.45

* New Resource: PublicDnsNamespace (hashicorp#2569)

* WIP

* Add test, docs

* Reflect reviews

* Modify error handling

* Update CHANGELOG.md

* New Resource: ServiceDiscovery PrivateDNS Namespace (hashicorp#2589)

* New Resource: service_discovery_private_dns_namespace

* Reflect reviews

* Update CHANGELOG.md
  • Loading branch information
psyvision authored Dec 12, 2017
1 parent 3b12ee1 commit 0a085fb
Show file tree
Hide file tree
Showing 414 changed files with 15,373 additions and 13,182 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

FEATURES:

* **New Datasource:** `aws_network_interface` [GH-2316]
* **New Data Source:** `aws_network_interface` [GH-2316]
* **New Data Source:** `aws_elb` [GH-2004]
* **New Resource:** `aws_dx_connection_association` [GH-2360]
* **New Resource:** `aws_appautoscaling_scheduled_action` [GH-2231]
* **New Resource:** `aws_cloudwatch_log_resource_policy` [GH-2243]
* **New Resource:** `aws_media_store_container` [GH-2448]
* **New Resource:** `aws_service_discovery_public_dns_namespace` [GH-2569]
* **New Resource:** `aws_service_discovery_private_dns_namespace` [GH-2589]

IMPROVEMENTS:

Expand All @@ -15,13 +19,19 @@ IMPROVEMENTS:
* resource/aws_ecs_service: Add `launch_type` (Fargate support) [GH-2483]
* resource/aws_ecs_task_definition: Add `cpu`, `memory`, `execution_role_arn` & `requires_compatibilities` (Fargate support) [GH-2483]
* resource/aws_ecs_cluster: Add arn attribute [GH-2552]
* resource/aws_elasticache_security_group: Add import support [GH-2277]
* resource/aws_sqs_queue_policy: Support import by queue URL [GH-2544]
* resource/aws_elasticsearch_domain: Add `log_publishing_options` [GH-2285]
* resource/aws_athena_database: Add `force_destroy` field [GH-2363]
* resource/aws_elasticache_replication_group: Add support for Redis auth, in-transit and at-rest encryption [GH-2090]

BUG FIXES:

* data-source/aws_instance: Set `placement_group` if available [GH-2400]
* resource/aws_elasticache_parameter_group: Add StateFunc to make name lowercase [GH-2426]
* resource/aws_elasticache_replication_group: Modify validation, make replication_group_id lowercase [GH-2432]
* resource/aws_db_instance: Treat `storage-optimization` as valid state [GH-2409]
* resource/aws_dynamodb_table: Ensure `ttl` is properly read [GH-2452]

## 1.5.0 (November 29, 2017)

Expand Down
7 changes: 6 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SWEEP?=us-east-1,us-west-2
TEST?=$$(go list ./... |grep -v 'vendor')
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)

Expand All @@ -6,6 +7,10 @@ default: build
build: fmtcheck
go install

sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
go test $(TEST) -v -sweep=$(SWEEP) $(SWEEPARGS)

test: fmtcheck
go test -i $(TEST) || exit 1
echo $(TEST) | \
Expand Down Expand Up @@ -43,5 +48,5 @@ test-compile:
fi
go test -c $(TEST) $(TESTARGS)

.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile
.PHONY: build sweep test testacc vet fmt fmtcheck errcheck vendor-status test-compile

6 changes: 6 additions & 0 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ import (
"github.com/aws/aws-sdk-go/service/kms"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/aws/aws-sdk-go/service/lightsail"
"github.com/aws/aws-sdk-go/service/mediastore"
"github.com/aws/aws-sdk-go/service/mq"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/aws/aws-sdk-go/service/rds"
"github.com/aws/aws-sdk-go/service/redshift"
"github.com/aws/aws-sdk-go/service/route53"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/servicecatalog"
"github.com/aws/aws-sdk-go/service/servicediscovery"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/aws/aws-sdk-go/service/sfn"
"github.com/aws/aws-sdk-go/service/simpledb"
Expand Down Expand Up @@ -180,6 +182,7 @@ type AWSClient struct {
codedeployconn *codedeploy.CodeDeploy
codecommitconn *codecommit.CodeCommit
codepipelineconn *codepipeline.CodePipeline
sdconn *servicediscovery.ServiceDiscovery
sfnconn *sfn.SFN
ssmconn *ssm.SSM
wafconn *waf.WAF
Expand All @@ -188,6 +191,7 @@ type AWSClient struct {
batchconn *batch.Batch
athenaconn *athena.Athena
dxconn *directconnect.DirectConnect
mediastoreconn *mediastore.MediaStore
}

func (c *AWSClient) S3() *s3.S3 {
Expand Down Expand Up @@ -416,6 +420,7 @@ func (c *Config) Client() (interface{}, error) {
client.simpledbconn = simpledb.New(sess)
client.s3conn = s3.New(awsS3Sess)
client.scconn = servicecatalog.New(sess)
client.sdconn = servicediscovery.New(sess)
client.sesConn = ses.New(sess)
client.sfnconn = sfn.New(sess)
client.snsconn = sns.New(awsSnsSess)
Expand All @@ -426,6 +431,7 @@ func (c *Config) Client() (interface{}, error) {
client.batchconn = batch.New(sess)
client.athenaconn = athena.New(sess)
client.dxconn = directconnect.New(sess)
client.mediastoreconn = mediastore.New(sess)

// Workaround for https://github.com/aws/aws-sdk-go/issues/1376
client.kinesisconn.Handlers.Retry.PushBack(func(r *request.Request) {
Expand Down
212 changes: 212 additions & 0 deletions aws/data_source_aws_elb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
package aws

import (
"fmt"
"log"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/hashicorp/terraform/helper/schema"
)

func dataSourceAwsElb() *schema.Resource {
return &schema.Resource{
Read: dataSourceAwsElbRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},

"access_logs": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"interval": {
Type: schema.TypeInt,
Computed: true,
},
"bucket": {
Type: schema.TypeString,
Computed: true,
},
"bucket_prefix": {
Type: schema.TypeString,
Computed: true,
},
"enabled": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"availability_zones": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Set: schema.HashString,
},

"connection_draining": {
Type: schema.TypeBool,
Computed: true,
},

"connection_draining_timeout": {
Type: schema.TypeInt,
Computed: true,
},

"cross_zone_load_balancing": {
Type: schema.TypeBool,
Computed: true,
},

"dns_name": {
Type: schema.TypeString,
Computed: true,
},

"health_check": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"healthy_threshold": {
Type: schema.TypeInt,
Computed: true,
},

"unhealthy_threshold": {
Type: schema.TypeInt,
Computed: true,
},

"target": {
Type: schema.TypeString,
Computed: true,
},

"interval": {
Type: schema.TypeInt,
Computed: true,
},

"timeout": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},

"idle_timeout": {
Type: schema.TypeInt,
Computed: true,
},

"instances": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Set: schema.HashString,
},

"internal": {
Type: schema.TypeBool,
Computed: true,
},

"listener": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"instance_port": {
Type: schema.TypeInt,
Computed: true,
},

"instance_protocol": {
Type: schema.TypeString,
Computed: true,
},

"lb_port": {
Type: schema.TypeInt,
Computed: true,
},

"lb_protocol": {
Type: schema.TypeString,
Computed: true,
},

"ssl_certificate_id": {
Type: schema.TypeString,
Computed: true,
},
},
},
Set: resourceAwsElbListenerHash,
},

"security_groups": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Set: schema.HashString,
},

"source_security_group": {
Type: schema.TypeString,
Computed: true,
},

"source_security_group_id": {
Type: schema.TypeString,
Computed: true,
},

"subnets": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Set: schema.HashString,
},

"tags": tagsSchemaComputed(),

"zone_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func dataSourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbconn
lbName := d.Get("name").(string)

input := &elb.DescribeLoadBalancersInput{
LoadBalancerNames: []*string{aws.String(lbName)},
}

log.Printf("[DEBUG] Reading ELBs: %#v", input)
resp, err := elbconn.DescribeLoadBalancers(input)
if err != nil {
return fmt.Errorf("Error retrieving LB: %s", err)
}
if len(resp.LoadBalancerDescriptions) != 1 {
return fmt.Errorf("Search returned %d results, please revise so only one is returned", len(resp.LoadBalancerDescriptions))
}
d.SetId(*resp.LoadBalancerDescriptions[0].LoadBalancerName)

return flattenAwsELbResource(d, meta.(*AWSClient).ec2conn, elbconn, resp.LoadBalancerDescriptions[0])
}
Loading

0 comments on commit 0a085fb

Please sign in to comment.