providers/aws: elb, eip config validations
This commit is contained in:
parent
3c3e584beb
commit
a87f2a7987
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/config"
|
||||||
"github.com/hashicorp/terraform/helper/diff"
|
"github.com/hashicorp/terraform/helper/diff"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/mitchellh/goamz/ec2"
|
"github.com/mitchellh/goamz/ec2"
|
||||||
|
@ -200,3 +201,12 @@ func resource_aws_eip_retrieve_address(id string, vpc bool, ec2conn *ec2.EC2) (*
|
||||||
|
|
||||||
return &address, nil
|
return &address, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resource_aws_eip_validation() *config.Validator {
|
||||||
|
return &config.Validator{
|
||||||
|
Optional: []string{
|
||||||
|
"vpc",
|
||||||
|
"instance",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -105,7 +105,6 @@ func testAccCheckAWSEIPExists(n string, res *ec2.Address) resource.TestCheckFunc
|
||||||
|
|
||||||
const testAccAWSEIPConfig = `
|
const testAccAWSEIPConfig = `
|
||||||
resource "aws_eip" "bar" {
|
resource "aws_eip" "bar" {
|
||||||
name = "foobar-terraform-test"
|
|
||||||
image_id = "ami-fb8e9292"
|
image_id = "ami-fb8e9292"
|
||||||
instance_type = "t1.micro"
|
instance_type = "t1.micro"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/flatmap"
|
"github.com/hashicorp/terraform/flatmap"
|
||||||
|
"github.com/hashicorp/terraform/helper/config"
|
||||||
"github.com/hashicorp/terraform/helper/diff"
|
"github.com/hashicorp/terraform/helper/diff"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/mitchellh/goamz/elb"
|
"github.com/mitchellh/goamz/elb"
|
||||||
|
@ -185,3 +186,20 @@ func resource_aws_elb_retrieve_balancer(id string, elbconn *elb.ELB) (*elb.LoadB
|
||||||
|
|
||||||
return &loadBalancer, nil
|
return &loadBalancer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resource_aws_elb_validation() *config.Validator {
|
||||||
|
return &config.Validator{
|
||||||
|
Required: []string{
|
||||||
|
"name",
|
||||||
|
"availability_zones.*",
|
||||||
|
"listener.*",
|
||||||
|
"listener.*.instance_port",
|
||||||
|
"listener.*.instance_protocol",
|
||||||
|
"listener.*.lb_port",
|
||||||
|
"listener.*.lb_protocol",
|
||||||
|
},
|
||||||
|
Optional: []string{
|
||||||
|
"instances",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -20,18 +20,20 @@ func init() {
|
||||||
},
|
},
|
||||||
|
|
||||||
"aws_elb": resource.Resource{
|
"aws_elb": resource.Resource{
|
||||||
Create: resource_aws_elb_create,
|
ConfigValidator: resource_aws_elb_validation(),
|
||||||
Update: resource_aws_elb_update,
|
Create: resource_aws_elb_create,
|
||||||
Destroy: resource_aws_elb_destroy,
|
Update: resource_aws_elb_update,
|
||||||
Diff: resource_aws_elb_diff,
|
Destroy: resource_aws_elb_destroy,
|
||||||
Refresh: resource_aws_elb_refresh,
|
Diff: resource_aws_elb_diff,
|
||||||
|
Refresh: resource_aws_elb_refresh,
|
||||||
},
|
},
|
||||||
|
|
||||||
"aws_eip": resource.Resource{
|
"aws_eip": resource.Resource{
|
||||||
Create: resource_aws_eip_create,
|
ConfigValidator: resource_aws_eip_validation(),
|
||||||
Destroy: resource_aws_eip_destroy,
|
Create: resource_aws_eip_create,
|
||||||
Diff: resource_aws_eip_diff,
|
Destroy: resource_aws_eip_destroy,
|
||||||
Refresh: resource_aws_eip_refresh,
|
Diff: resource_aws_eip_diff,
|
||||||
|
Refresh: resource_aws_eip_refresh,
|
||||||
},
|
},
|
||||||
|
|
||||||
"aws_instance": resource.Resource{
|
"aws_instance": resource.Resource{
|
||||||
|
|
Loading…
Reference in New Issue