Merge pull request #11474 from hashicorp/b-fix-aws-alb-import

provider/aws: Import aws_alb_listener_rule fix
This commit is contained in:
Jake Champlin 2017-01-30 08:49:24 -05:00 committed by GitHub
commit 9cdd7547e1
1 changed files with 8 additions and 3 deletions

View File

@ -144,10 +144,15 @@ func resourceAwsAlbListenerRuleRead(d *schema.ResourceData, meta interface{}) er
rule := resp.Rules[0]
d.Set("arn", rule.RuleArn)
if priority, err := strconv.Atoi(*rule.Priority); err != nil {
return errwrap.Wrapf("Cannot convert rule priority %q to int: {{err}}", err)
// Rules are evaluated in priority order, from the lowest value to the highest value. The default rule has the lowest priority.
if *rule.Priority == "default" {
d.Set("priority", 99999)
} else {
d.Set("priority", priority)
if priority, err := strconv.Atoi(*rule.Priority); err != nil {
return errwrap.Wrapf("Cannot convert rule priority %q to int: {{err}}", err)
} else {
d.Set("priority", priority)
}
}
actions := make([]interface{}, len(rule.Actions))