Merge branch 'master' into 2087-consul-service-resource

This commit is contained in:
Max Englander 2015-10-29 11:43:12 -04:00
commit fa94d7f7ec
5 changed files with 31 additions and 12 deletions

View File

@ -13,6 +13,7 @@ IMPROVEMENTS:
* null_resource: enhance and document [GH-3244, GH-3659] * null_resource: enhance and document [GH-3244, GH-3659]
* provider/aws: Add CORS settings to S3 bucket [GH-3387] * provider/aws: Add CORS settings to S3 bucket [GH-3387]
* provider/aws: Add notification topic ARN for ElastiCache clusters [GH-3674] * provider/aws: Add notification topic ARN for ElastiCache clusters [GH-3674]
* provider/aws: Add `kinesis_endpoint` for configuring Kinesis [GH-3255]
BUG FIXES: BUG FIXES:
@ -22,6 +23,7 @@ BUG FIXES:
* provider/aws: Fix issue with order of Termincation Policies in AutoScaling Groups. * 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] 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: Allow cluster name, not only ARN for `aws_ecs_service` [GH-3668]
* provider/vsphere: Fix d.SetConnInfo error in case of a missing IP address [GH-3636]
## 0.6.6 (October 23, 2015) ## 0.6.6 (October 23, 2015)

View File

@ -48,6 +48,7 @@ type Config struct {
ForbiddenAccountIds []interface{} ForbiddenAccountIds []interface{}
DynamoDBEndpoint string DynamoDBEndpoint string
KinesisEndpoint string
} }
type AWSClient struct { type AWSClient struct {
@ -116,12 +117,6 @@ func (c *Config) Client() (interface{}, error) {
errs = append(errs, err) 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 // Some services exist only in us-east-1, e.g. because they manage
// resources that can span across multiple regions, or because // resources that can span across multiple regions, or because
// signature format v4 requires region to be us-east-1 for global // signature format v4 requires region to be us-east-1 for global
@ -134,8 +129,11 @@ func (c *Config) Client() (interface{}, error) {
HTTPClient: cleanhttp.DefaultClient(), HTTPClient: cleanhttp.DefaultClient(),
} }
awsDynamoDBConfig := *awsConfig
awsDynamoDBConfig.Endpoint = aws.String(c.DynamoDBEndpoint)
log.Println("[INFO] Initializing DynamoDB connection") log.Println("[INFO] Initializing DynamoDB connection")
client.dynamodbconn = dynamodb.New(awsDynamoDBConfig) client.dynamodbconn = dynamodb.New(&awsDynamoDBConfig)
log.Println("[INFO] Initializing ELB connection") log.Println("[INFO] Initializing ELB connection")
client.elbconn = elb.New(awsConfig) client.elbconn = elb.New(awsConfig)
@ -152,8 +150,11 @@ func (c *Config) Client() (interface{}, error) {
log.Println("[INFO] Initializing RDS Connection") log.Println("[INFO] Initializing RDS Connection")
client.rdsconn = rds.New(awsConfig) client.rdsconn = rds.New(awsConfig)
awsKinesisConfig := *awsConfig
awsKinesisConfig.Endpoint = aws.String(c.KinesisEndpoint)
log.Println("[INFO] Initializing Kinesis Connection") log.Println("[INFO] Initializing Kinesis Connection")
client.kinesisconn = kinesis.New(awsConfig) client.kinesisconn = kinesis.New(&awsKinesisConfig)
authErr := c.ValidateAccountId(client.iamconn) authErr := c.ValidateAccountId(client.iamconn)
if authErr != nil { if authErr != nil {

View File

@ -153,6 +153,13 @@ func Provider() terraform.ResourceProvider {
Default: "", Default: "",
Description: descriptions["dynamodb_endpoint"], Description: descriptions["dynamodb_endpoint"],
}, },
"kinesis_endpoint": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["kinesis_endpoint"],
},
}, },
ResourcesMap: map[string]*schema.Resource{ ResourcesMap: map[string]*schema.Resource{
@ -283,6 +290,9 @@ func init() {
"dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" + "dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to dynamodb-local.", "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.",
} }
} }
@ -294,6 +304,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
Region: d.Get("region").(string), Region: d.Get("region").(string),
MaxRetries: d.Get("max_retries").(int), MaxRetries: d.Get("max_retries").(int),
DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string), DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string),
KinesisEndpoint: d.Get("kinesis_endpoint").(string),
} }
if v, ok := d.GetOk("allowed_account_ids"); ok { if v, ok := d.GetOk("allowed_account_ids"); ok {

View File

@ -389,6 +389,7 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
networkInterfaces = append(networkInterfaces, networkInterface) networkInterfaces = append(networkInterfaces, networkInterface)
} }
} }
log.Printf("[DEBUG] networkInterfaces: %#v", networkInterfaces)
err = d.Set("network_interface", networkInterfaces) err = d.Set("network_interface", networkInterfaces)
if err != nil { if err != nil {
return fmt.Errorf("Invalid network interfaces to set: %#v", networkInterfaces) return fmt.Errorf("Invalid network interfaces to set: %#v", networkInterfaces)
@ -420,10 +421,12 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
d.Set("datastore", rootDatastore) d.Set("datastore", rootDatastore)
// Initialize the connection info // Initialize the connection info
d.SetConnInfo(map[string]string{ if len(networkInterfaces) > 0 {
"type": "ssh", d.SetConnInfo(map[string]string{
"host": networkInterfaces[0]["ip_address"].(string), "type": "ssh",
}) "host": networkInterfaces[0]["ip_address"].(string),
})
}
return nil return nil
} }

View File

@ -57,5 +57,7 @@ The following arguments are supported in the `provider` block:
* `dynamodb_endpoint` - (Optional) Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to dynamodb-local. * `dynamodb_endpoint` - (Optional) Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to dynamodb-local.
* `kinesis_endpoint` - (Optional) Use this to override the default endpoint URL constructed from the `region`. It's typically used to connect to kinesalite.
In addition to the above parameters, the `AWS_SESSION_TOKEN` environmental In addition to the above parameters, the `AWS_SESSION_TOKEN` environmental
variable can be set to set an MFA token. variable can be set to set an MFA token.