Strike 'goamz' from the repo'
This commit is contained in:
parent
57556bba75
commit
580b696e7f
|
@ -7,17 +7,14 @@ import (
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/multierror"
|
"github.com/hashicorp/terraform/helper/multierror"
|
||||||
"github.com/mitchellh/goamz/aws"
|
|
||||||
"github.com/mitchellh/goamz/ec2"
|
|
||||||
|
|
||||||
awsGo "github.com/hashicorp/aws-sdk-go/aws"
|
"github.com/hashicorp/aws-sdk-go/aws"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/autoscaling"
|
"github.com/hashicorp/aws-sdk-go/gen/autoscaling"
|
||||||
|
"github.com/hashicorp/aws-sdk-go/gen/ec2"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/elb"
|
"github.com/hashicorp/aws-sdk-go/gen/elb"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/rds"
|
"github.com/hashicorp/aws-sdk-go/gen/rds"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/route53"
|
"github.com/hashicorp/aws-sdk-go/gen/route53"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/s3"
|
"github.com/hashicorp/aws-sdk-go/gen/s3"
|
||||||
|
|
||||||
awsEC2 "github.com/hashicorp/aws-sdk-go/gen/ec2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
@ -29,7 +26,6 @@ type Config struct {
|
||||||
|
|
||||||
type AWSClient struct {
|
type AWSClient struct {
|
||||||
ec2conn *ec2.EC2
|
ec2conn *ec2.EC2
|
||||||
awsEC2conn *awsEC2.EC2
|
|
||||||
elbconn *elb.ELB
|
elbconn *elb.ELB
|
||||||
autoscalingconn *autoscaling.AutoScaling
|
autoscalingconn *autoscaling.AutoScaling
|
||||||
s3conn *s3.S3
|
s3conn *s3.S3
|
||||||
|
@ -62,10 +58,8 @@ func (c *Config) Client() (interface{}, error) {
|
||||||
// bucket storage in S3
|
// bucket storage in S3
|
||||||
client.region = c.Region
|
client.region = c.Region
|
||||||
|
|
||||||
creds := awsGo.Creds(c.AccessKey, c.SecretKey, c.Token)
|
creds := aws.Creds(c.AccessKey, c.SecretKey, c.Token)
|
||||||
|
|
||||||
log.Println("[INFO] Initializing EC2 connection")
|
|
||||||
client.ec2conn = ec2.New(auth, region)
|
|
||||||
log.Println("[INFO] Initializing ELB connection")
|
log.Println("[INFO] Initializing ELB connection")
|
||||||
client.elbconn = elb.New(creds, c.Region, nil)
|
client.elbconn = elb.New(creds, c.Region, nil)
|
||||||
log.Println("[INFO] Initializing AutoScaling connection")
|
log.Println("[INFO] Initializing AutoScaling connection")
|
||||||
|
@ -80,7 +74,7 @@ func (c *Config) Client() (interface{}, error) {
|
||||||
// See http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html
|
// See http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html
|
||||||
log.Println("[INFO] Initializing Route53 connection")
|
log.Println("[INFO] Initializing Route53 connection")
|
||||||
client.r53conn = route53.New(creds, "us-east-1", nil)
|
client.r53conn = route53.New(creds, "us-east-1", nil)
|
||||||
log.Println("[INFO] Initializing AWS-GO EC2 Connection")
|
log.Println("[INFO] Initializing EC2 Connection")
|
||||||
client.awsEC2conn = awsEC2.New(creds, c.Region, nil)
|
client.awsEC2conn = awsEC2.New(creds, c.Region, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ func resourceAwsDbParameterGroupUpdate(d *schema.ResourceData, meta interface{})
|
||||||
os := o.(*schema.Set)
|
os := o.(*schema.Set)
|
||||||
ns := n.(*schema.Set)
|
ns := n.(*schema.Set)
|
||||||
|
|
||||||
// Expand the "parameter" set to goamz compat []rds.Parameter
|
// Expand the "parameter" set to aws-sdk-go compat []rds.Parameter
|
||||||
parameters, err := expandParameters(ns.Difference(os).List())
|
parameters, err := expandParameters(ns.Difference(os).List())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -161,7 +161,7 @@ func resourceAwsElb() *schema.Resource {
|
||||||
func resourceAwsElbCreate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsElbCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
elbconn := meta.(*AWSClient).elbconn
|
elbconn := meta.(*AWSClient).elbconn
|
||||||
|
|
||||||
// Expand the "listener" set to goamz compat []elb.Listener
|
// Expand the "listener" set to aws-sdk-go compat []elb.Listener
|
||||||
listeners, err := expandListeners(d.Get("listener").(*schema.Set).List())
|
listeners, err := expandListeners(d.Get("listener").(*schema.Set).List())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -4,11 +4,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/aws-sdk-go/aws"
|
"github.com/hashicorp/aws-sdk-go/aws"
|
||||||
awsEC2 "github.com/hashicorp/aws-sdk-go/gen/ec2"
|
"github.com/hashicorp/aws-sdk-go/gen/ec2"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/elb"
|
"github.com/hashicorp/aws-sdk-go/gen/elb"
|
||||||
"github.com/hashicorp/aws-sdk-go/gen/rds"
|
"github.com/hashicorp/aws-sdk-go/gen/rds"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
"github.com/mitchellh/goamz/ec2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Takes the result of flatmap.Expand for an array of listeners and
|
// Takes the result of flatmap.Expand for an array of listeners and
|
||||||
|
@ -17,7 +16,7 @@ func expandListeners(configured []interface{}) ([]elb.Listener, error) {
|
||||||
listeners := make([]elb.Listener, 0, len(configured))
|
listeners := make([]elb.Listener, 0, len(configured))
|
||||||
|
|
||||||
// Loop over our configured listeners and create
|
// Loop over our configured listeners and create
|
||||||
// an array of goamz compatabile objects
|
// an array of aws-sdk-go compatabile objects
|
||||||
for _, lRaw := range configured {
|
for _, lRaw := range configured {
|
||||||
data := lRaw.(map[string]interface{})
|
data := lRaw.(map[string]interface{})
|
||||||
|
|
||||||
|
@ -40,10 +39,10 @@ func expandListeners(configured []interface{}) ([]elb.Listener, error) {
|
||||||
|
|
||||||
// Takes the result of flatmap.Expand for an array of ingress/egress
|
// Takes the result of flatmap.Expand for an array of ingress/egress
|
||||||
// security group rules and returns EC2 API compatible objects
|
// security group rules and returns EC2 API compatible objects
|
||||||
func expandIPPerms(id string, configured []interface{}) []awsEC2.IPPermission {
|
func expandIPPerms(id string, configured []interface{}) []ec2.IPPermission {
|
||||||
perms := make([]awsEC2.IPPermission, len(configured))
|
perms := make([]ec2.IPPermission, len(configured))
|
||||||
for i, mRaw := range configured {
|
for i, mRaw := range configured {
|
||||||
var perm awsEC2.IPPermission
|
var perm ec2.IPPermission
|
||||||
m := mRaw.(map[string]interface{})
|
m := mRaw.(map[string]interface{})
|
||||||
|
|
||||||
perm.FromPort = aws.Integer(m["from_port"].(int))
|
perm.FromPort = aws.Integer(m["from_port"].(int))
|
||||||
|
@ -62,14 +61,14 @@ func expandIPPerms(id string, configured []interface{}) []awsEC2.IPPermission {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(groups) > 0 {
|
if len(groups) > 0 {
|
||||||
perm.UserIDGroupPairs = make([]awsEC2.UserIDGroupPair, len(groups))
|
perm.UserIDGroupPairs = make([]ec2.UserIDGroupPair, len(groups))
|
||||||
for i, name := range groups {
|
for i, name := range groups {
|
||||||
ownerId, id := "", name
|
ownerId, id := "", name
|
||||||
if items := strings.Split(id, "/"); len(items) > 1 {
|
if items := strings.Split(id, "/"); len(items) > 1 {
|
||||||
ownerId, id = items[0], items[1]
|
ownerId, id = items[0], items[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
perm.UserIDGroupPairs[i] = awsEC2.UserIDGroupPair{
|
perm.UserIDGroupPairs[i] = ec2.UserIDGroupPair{
|
||||||
GroupID: aws.String(id),
|
GroupID: aws.String(id),
|
||||||
UserID: aws.String(ownerId),
|
UserID: aws.String(ownerId),
|
||||||
}
|
}
|
||||||
|
@ -78,9 +77,9 @@ func expandIPPerms(id string, configured []interface{}) []awsEC2.IPPermission {
|
||||||
|
|
||||||
if raw, ok := m["cidr_blocks"]; ok {
|
if raw, ok := m["cidr_blocks"]; ok {
|
||||||
list := raw.([]interface{})
|
list := raw.([]interface{})
|
||||||
perm.IPRanges = make([]awsEC2.IPRange, len(list))
|
perm.IPRanges = make([]ec2.IPRange, len(list))
|
||||||
for i, v := range list {
|
for i, v := range list {
|
||||||
perm.IPRanges[i] = awsEC2.IPRange{aws.String(v.(string))}
|
perm.IPRanges[i] = ec2.IPRange{aws.String(v.(string))}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +95,7 @@ func expandParameters(configured []interface{}) ([]rds.Parameter, error) {
|
||||||
parameters := make([]rds.Parameter, 0, len(configured))
|
parameters := make([]rds.Parameter, 0, len(configured))
|
||||||
|
|
||||||
// Loop over our configured parameters and create
|
// Loop over our configured parameters and create
|
||||||
// an array of goamz compatabile objects
|
// an array of aws-sdk-go compatabile objects
|
||||||
for _, pRaw := range configured {
|
for _, pRaw := range configured {
|
||||||
data := pRaw.(map[string]interface{})
|
data := pRaw.(map[string]interface{})
|
||||||
|
|
||||||
|
@ -139,7 +138,7 @@ func flattenSecurityGroups(list []ec2.UserSecurityGroup) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flattens an array of UserSecurityGroups into a []string
|
// Flattens an array of UserSecurityGroups into a []string
|
||||||
func flattenSecurityGroupsSDK(list []awsEC2.UserIDGroupPair) []string {
|
func flattenSecurityGroupsSDK(list []ec2.UserIDGroupPair) []string {
|
||||||
result := make([]string, 0, len(list))
|
result := make([]string, 0, len(list))
|
||||||
for _, g := range list {
|
for _, g := range list {
|
||||||
result = append(result, *g.GroupID)
|
result = append(result, *g.GroupID)
|
||||||
|
|
|
@ -56,4 +56,4 @@ The following attributes are exported:
|
||||||
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
You still have to accept the peering with the aws console, aws-cli or goamz
|
You still have to accept the peering with the aws console, aws-cli or aws-sdk-go.
|
||||||
|
|
Loading…
Reference in New Issue