Skip to content

Commit

Permalink
Merge branch 'master' into f-aws-elastic-beanstalk
Browse files Browse the repository at this point in the history
* master: (132 commits)
  provider/openstack: fix test formatting
  Update CHANGELOG.md
  Fixing the RDS Cluster Instance docs to show that either an instance must be set as public OR have a db_subnet_group_name set
  Fix tests
  Update CHANGELOG.md
  Update CHANGELOG.md
  Removing an unnecessary duplicate test for the RDS Cluster Backups
  provider/openstack: fixed_ips implementation for ports
  Update CHANGELOG.md
  Logging that the DO droplet wasn't found before removing it
  ElastiCache cluster read tolerates removed cluster.
  Changing the DigitalOcean Droplet 404 from a message string to an actual 404 status code
  Fixing the DigitalOcean Droplet 404 potential on refresh of state
  Changes after the feedback from @catsby - these all made perfect sense
  provider/digitalocean: enhance user_data test
  Fixing the spelling mistakes and adding a test to prove that the Updates to the new properties of RDS Cluster work as expected
  Update CHANGELOG.md
  Adding backup_retention_period, preferred_backup_window and preferred_maintenance_window to RDS Cluster
  Making user_data force a new droplet for DigitalOcean
  Update CHANGELOG.md
  ...
  • Loading branch information
catsby committed Nov 6, 2015
2 parents cbc010d + fa471dd commit c257708
Show file tree
Hide file tree
Showing 166 changed files with 12,011 additions and 621 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
language: go

go:
- 1.4
- 1.5
- tip

install: make updatedeps
Expand Down
56 changes: 51 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,63 @@
## 0.6.7 (Unreleased)

BUG FIXES:
FEATURES:

* `terraform remote config`: update `--help` output [GH-3632]
* provider/google: Timeout when deleting large instance_group_manager [GH-3591]
* provider/aws: Fix issue with order of Termincation Policies in AutoScaling Groups.
This will introduce plans on upgrade to this version, in order to correct the ordering [GH-2890]
* **New resource: `aws_cloudformation_stack`** [GH-2636]
* **New resource: `aws_cloudtrail`** [GH-3094]
* **New resource: `aws_route`** [GH-3548]
* **New resource: `aws_codecommit_repository`** [GH-3274]
* **New provider: `tls`** - A utility provider for generating TLS keys/self-signed certificates for development and testing [GH-2778]
* **New resource: `google_sql_database` and `google_sql_database_instance`** [GH-3617]
* **New resource: `google_compute_global_address`** [GH-3701]
* **New resource: `google_compute_ssl_certificate`** [GH-3723]
* **New resource: `google_compute_url_map`** [GH-3722]
* **New resource: `google_compute_target_http_proxy`** [GH-3727]
* **New resource: `google_compute_target_https_proxy`** [GH-3728]
* **New resource: `google_compute_global_forwarding_rule`** [GH-3702]
* **New resource: `openstack_networking_port_v2`** [GH-3731]

IMPROVEMENTS:

* provider/google: preemptible option for instance_template [GH-3667]
* provider/google: Accurate Terraform Version [GH-3554]
* provider/google: Simplified auth (DefaultClient support) [GH-3553]
* provider/google: automatic_restart, preemptible, on_host_maintenance options [GH-3643]
* null_resource: enhance and document [GH-3244, GH-3659]
* provider/aws: Add CORS settings to S3 bucket [GH-3387]
* provider/aws: Add notification topic ARN for ElastiCache clusters [GH-3674]
* provider/aws: Add `kinesis_endpoint` for configuring Kinesis [GH-3255]
* provider/aws: Add a computed ARN for S3 Buckets [GH-3685]
* provider/aws: Add configuration to enable copying RDS tags to final snapshot [GH-3529]
* provider/aws: RDS Cluster additions (`backup_retention_period`, `preferred_backup_window`, `preferred_maintenance_window`) [GH-3757]
* provider/openstack: Use IPv4 as the defeault IP version for subnets [GH-3091]
* provider/aws: Apply security group after restoring db_instance from snapshot [GH-3513]
* provider/aws: Making the AutoScalingGroup name optional [GH-3710]
* provider/openstack: Add "delete on termination" boot-from-volume option [GH-3232]
* provider/digitalocean: Make user_data force a new droplet [GH-3740]
* provider/vsphere: Do not add network interfaces by default [GH-3652]
* provider/openstack: Configure Fixed IPs through ports [GH-3772]

BUG FIXES:

* `terraform remote config`: update `--help` output [GH-3632]
* core: modules on Git branches now update properly [GH-1568]
* provider/google: Timeout when deleting large instance_group_manager [GH-3591]
* provider/aws: Fix issue with order of Termincation Policies in AutoScaling Groups.
This will introduce plans on upgrade to this version, in order to correct the ordering [GH-2890]
* provider/aws: Allow cluster name, not only ARN for `aws_ecs_service` [GH-3668]
* provider/aws: ignore association not exist on route table destroy [GH-3615]
* provider/aws: Fix policy encoding issue with SNS Topics [GH-3700]
* provider/aws: Tolerate ElastiCache clusters being deleted outside Terraform [GH-3767]
* provider/azure: various bugfixes [GH-3695]
* provider/digitalocean: fix issue preventing SSH fingerprints from working [GH-3633]
* provider/digitalocean: Fixing the DigitalOcean Droplet 404 potential on refresh of state [GH-3768]
* provider/openstack: Fix several issues causing unresolvable diffs [GH-3440]
* provider/openstack: Safely delete security groups [GH-3696]
* provider/openstack: Ignore order of security_groups in instance [GH-3651]
* provider/vsphere: Fix d.SetConnInfo error in case of a missing IP address [GH-3636]
* provider/openstack: Fix boot from volume [GH-3206]
* provider/openstack: Fix crashing when image is no longer accessible [GH-2189]
* provider/openstack: Better handling of network resource state changes [GH-3712]

## 0.6.6 (October 23, 2015)

Expand Down
12 changes: 12 additions & 0 deletions builtin/bins/provider-tls/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/tls"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: tls.Provider,
})
}
79 changes: 50 additions & 29 deletions builtin/providers/aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/aws/aws-sdk-go/service/cloudtrail"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"github.com/aws/aws-sdk-go/service/codecommit"
"github.com/aws/aws-sdk-go/service/codedeploy"
"github.com/aws/aws-sdk-go/service/directoryservice"
"github.com/aws/aws-sdk-go/service/dynamodb"
Expand Down Expand Up @@ -47,9 +51,12 @@ type Config struct {
ForbiddenAccountIds []interface{}

DynamoDBEndpoint string
KinesisEndpoint string
}

type AWSClient struct {
cfconn *cloudformation.CloudFormation
cloudtrailconn *cloudtrail.CloudTrail
cloudwatchconn *cloudwatch.CloudWatch
cloudwatchlogsconn *cloudwatchlogs.CloudWatchLogs
dsconn *directoryservice.DirectoryService
Expand All @@ -74,6 +81,7 @@ type AWSClient struct {
opsworksconn *opsworks.OpsWorks
glacierconn *glacier.Glacier
codedeployconn *codedeploy.CodeDeploy
codecommitconn *codecommit.CodeCommit
}

// Client configures and returns a fully initialized AWSClient
Expand Down Expand Up @@ -107,19 +115,14 @@ func (c *Config) Client() (interface{}, error) {
}

log.Println("[INFO] Initializing IAM Connection")
client.iamconn = iam.New(awsConfig)
sess := session.New(awsConfig)
client.iamconn = iam.New(sess)

err := c.ValidateCredentials(client.iamconn)
if err != nil {
errs = append(errs, err)
}

awsDynamoDBConfig := &aws.Config{
Credentials: creds,
Region: aws.String(c.Region),
MaxRetries: aws.Int(c.MaxRetries),
Endpoint: aws.String(c.DynamoDBEndpoint),
}
// Some services exist only in us-east-1, e.g. because they manage
// resources that can span across multiple regions, or because
// signature format v4 requires region to be us-east-1 for global
Expand All @@ -131,77 +134,95 @@ func (c *Config) Client() (interface{}, error) {
MaxRetries: aws.Int(c.MaxRetries),
HTTPClient: cleanhttp.DefaultClient(),
}
usEast1Sess := session.New(usEast1AwsConfig)

awsDynamoDBConfig := *awsConfig
awsDynamoDBConfig.Endpoint = aws.String(c.DynamoDBEndpoint)

log.Println("[INFO] Initializing DynamoDB connection")
client.dynamodbconn = dynamodb.New(awsDynamoDBConfig)
dynamoSess := session.New(&awsDynamoDBConfig)
client.dynamodbconn = dynamodb.New(dynamoSess)

log.Println("[INFO] Initializing ELB connection")
client.elbconn = elb.New(awsConfig)
client.elbconn = elb.New(sess)

log.Println("[INFO] Initializing S3 connection")
client.s3conn = s3.New(awsConfig)
client.s3conn = s3.New(sess)

log.Println("[INFO] Initializing SQS connection")
client.sqsconn = sqs.New(awsConfig)
client.sqsconn = sqs.New(sess)

log.Println("[INFO] Initializing SNS connection")
client.snsconn = sns.New(awsConfig)
client.snsconn = sns.New(sess)

log.Println("[INFO] Initializing RDS Connection")
client.rdsconn = rds.New(awsConfig)
client.rdsconn = rds.New(sess)

awsKinesisConfig := *awsConfig
awsKinesisConfig.Endpoint = aws.String(c.KinesisEndpoint)

log.Println("[INFO] Initializing Kinesis Connection")
client.kinesisconn = kinesis.New(awsConfig)
kinesisSess := session.New(&awsKinesisConfig)
client.kinesisconn = kinesis.New(kinesisSess)

log.Println("[INFO] Initializing Elastic Beanstalk Connection")
client.elasticbeanstalkconn = elasticbeanstalk.New(awsConfig)
client.elasticbeanstalkconn = elasticbeanstalk.New(sess)

authErr := c.ValidateAccountId(client.iamconn)
if authErr != nil {
errs = append(errs, authErr)
}

log.Println("[INFO] Initializing AutoScaling connection")
client.autoscalingconn = autoscaling.New(awsConfig)
client.autoscalingconn = autoscaling.New(sess)

log.Println("[INFO] Initializing EC2 Connection")
client.ec2conn = ec2.New(awsConfig)
client.ec2conn = ec2.New(sess)

log.Println("[INFO] Initializing ECS Connection")
client.ecsconn = ecs.New(awsConfig)
client.ecsconn = ecs.New(sess)

log.Println("[INFO] Initializing EFS Connection")
client.efsconn = efs.New(awsConfig)
client.efsconn = efs.New(sess)

log.Println("[INFO] Initializing ElasticSearch Connection")
client.esconn = elasticsearch.New(awsConfig)
client.esconn = elasticsearch.New(sess)

log.Println("[INFO] Initializing Route 53 connection")
client.r53conn = route53.New(usEast1AwsConfig)
client.r53conn = route53.New(usEast1Sess)

log.Println("[INFO] Initializing Elasticache Connection")
client.elasticacheconn = elasticache.New(awsConfig)
client.elasticacheconn = elasticache.New(sess)

log.Println("[INFO] Initializing Lambda Connection")
client.lambdaconn = lambda.New(awsConfig)
client.lambdaconn = lambda.New(sess)

log.Println("[INFO] Initializing Cloudformation Connection")
client.cfconn = cloudformation.New(sess)

log.Println("[INFO] Initializing CloudWatch SDK connection")
client.cloudwatchconn = cloudwatch.New(awsConfig)
client.cloudwatchconn = cloudwatch.New(sess)

log.Println("[INFO] Initializing CloudTrail connection")
client.cloudtrailconn = cloudtrail.New(sess)

log.Println("[INFO] Initializing CloudWatch Logs connection")
client.cloudwatchlogsconn = cloudwatchlogs.New(awsConfig)
client.cloudwatchlogsconn = cloudwatchlogs.New(sess)

log.Println("[INFO] Initializing OpsWorks Connection")
client.opsworksconn = opsworks.New(usEast1AwsConfig)
client.opsworksconn = opsworks.New(usEast1Sess)

log.Println("[INFO] Initializing Directory Service connection")
client.dsconn = directoryservice.New(awsConfig)
client.dsconn = directoryservice.New(sess)

log.Println("[INFO] Initializing Glacier connection")
client.glacierconn = glacier.New(awsConfig)
client.glacierconn = glacier.New(sess)

log.Println("[INFO] Initializing CodeDeploy Connection")
client.codedeployconn = codedeploy.New(awsConfig)
client.codedeployconn = codedeploy.New(sess)

log.Println("[INFO] Initializing CodeCommit SDK connection")
client.codecommitconn = codecommit.New(usEast1Sess)
}

if len(errs) > 0 {
Expand Down
21 changes: 18 additions & 3 deletions builtin/providers/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ func Provider() terraform.ResourceProvider {
Default: "",
Description: descriptions["dynamodb_endpoint"],
},

"kinesis_endpoint": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["kinesis_endpoint"],
},
},

ResourcesMap: map[string]*schema.Resource{
Expand All @@ -163,11 +170,14 @@ func Provider() terraform.ResourceProvider {
"aws_autoscaling_group": resourceAwsAutoscalingGroup(),
"aws_autoscaling_notification": resourceAwsAutoscalingNotification(),
"aws_autoscaling_policy": resourceAwsAutoscalingPolicy(),
"aws_cloudformation_stack": resourceAwsCloudFormationStack(),
"aws_cloudtrail": resourceAwsCloudTrail(),
"aws_cloudwatch_log_group": resourceAwsCloudWatchLogGroup(),
"aws_autoscaling_lifecycle_hook": resourceAwsAutoscalingLifecycleHook(),
"aws_cloudwatch_metric_alarm": resourceAwsCloudWatchMetricAlarm(),
"aws_codedeploy_app": resourceAwsCodeDeployApp(),
"aws_codedeploy_deployment_group": resourceAwsCodeDeployDeploymentGroup(),
"aws_codecommit_repository": resourceAwsCodeCommitRepository(),
"aws_customer_gateway": resourceAwsCustomerGateway(),
"aws_db_instance": resourceAwsDbInstance(),
"aws_db_parameter_group": resourceAwsDbParameterGroup(),
Expand All @@ -183,13 +193,13 @@ func Provider() terraform.ResourceProvider {
"aws_efs_mount_target": resourceAwsEfsMountTarget(),
"aws_eip": resourceAwsEip(),
"aws_elasticache_cluster": resourceAwsElasticacheCluster(),
"aws_elastic_beanstalk_application": resourceAwsElasticBeanstalkApplication(),
"aws_elastic_beanstalk_configuration_template": resourceAwsElasticBeanstalkConfigurationTemplate(),
"aws_elastic_beanstalk_environment": resourceAwsElasticBeanstalkEnvironment(),
"aws_elasticache_parameter_group": resourceAwsElasticacheParameterGroup(),
"aws_elasticache_security_group": resourceAwsElasticacheSecurityGroup(),
"aws_elasticache_subnet_group": resourceAwsElasticacheSubnetGroup(),
"aws_elasticsearch_domain": resourceAwsElasticSearchDomain(),
"aws_elastic_beanstalk_application": resourceAwsElasticBeanstalkApplication(),
"aws_elastic_beanstalk_configuration_template": resourceAwsElasticBeanstalkConfigurationTemplate(),
"aws_elastic_beanstalk_environment": resourceAwsElasticBeanstalkEnvironment(),
"aws_elb": resourceAwsElb(),
"aws_flow_log": resourceAwsFlowLog(),
"aws_glacier_vault": resourceAwsGlacierVault(),
Expand Down Expand Up @@ -236,6 +246,7 @@ func Provider() terraform.ResourceProvider {
"aws_route53_zone_association": resourceAwsRoute53ZoneAssociation(),
"aws_route53_zone": resourceAwsRoute53Zone(),
"aws_route53_health_check": resourceAwsRoute53HealthCheck(),
"aws_route": resourceAwsRoute(),
"aws_route_table": resourceAwsRouteTable(),
"aws_route_table_association": resourceAwsRouteTableAssociation(),
"aws_s3_bucket": resourceAwsS3Bucket(),
Expand Down Expand Up @@ -284,6 +295,9 @@ func init() {

"dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to dynamodb-local.",

"kinesis_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to kinesalite.",
}
}

Expand All @@ -295,6 +309,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
Region: d.Get("region").(string),
MaxRetries: d.Get("max_retries").(int),
DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string),
KinesisEndpoint: d.Get("kinesis_endpoint").(string),
}

if v, ok := d.GetOk("allowed_account_ids"); ok {
Expand Down
14 changes: 12 additions & 2 deletions builtin/providers/aws/resource_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
// https://github.com/boto/botocore/blob/9f322b1/botocore/data/autoscaling/2011-01-01/service-2.json#L1862-L1873
Expand Down Expand Up @@ -144,7 +145,16 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).autoscalingconn

var autoScalingGroupOpts autoscaling.CreateAutoScalingGroupInput
autoScalingGroupOpts.AutoScalingGroupName = aws.String(d.Get("name").(string))

var asgName string
if v, ok := d.GetOk("name"); ok {
asgName = v.(string)
} else {
asgName = resource.PrefixedUniqueId("tf-asg-")
d.Set("name", asgName)
}

autoScalingGroupOpts.AutoScalingGroupName = aws.String(asgName)
autoScalingGroupOpts.LaunchConfigurationName = aws.String(d.Get("launch_configuration").(string))
autoScalingGroupOpts.MinSize = aws.Int64(int64(d.Get("min_size").(int)))
autoScalingGroupOpts.MaxSize = aws.Int64(int64(d.Get("max_size").(int)))
Expand Down
Loading

0 comments on commit c257708

Please sign in to comment.