Skip to content

Commit

Permalink
Merge pull request #6154 from gseyetik/lb-listener-rule-eventual-cons…
Browse files Browse the repository at this point in the history
…istency

aws_lb_listener_rule: Add eventualy consistent read after creation
  • Loading branch information
bflad authored Oct 14, 2018
2 parents 6e1b0f5 + 6eb0bd2 commit cbbf778
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion aws/resource_aws_lb_listener_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,24 @@ func resourceAwsLbListenerRuleCreate(d *schema.ResourceData, meta interface{}) e
func resourceAwsLbListenerRuleRead(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbv2conn

resp, err := elbconn.DescribeRules(&elbv2.DescribeRulesInput{
var resp *elbv2.DescribeRulesOutput
var req = &elbv2.DescribeRulesInput{
RuleArns: []*string{aws.String(d.Id())},
}

err := resource.Retry(1*time.Minute, func() *resource.RetryError {
var err error
resp, err = elbconn.DescribeRules(req)
if err != nil {
if d.IsNewResource() && isAWSErr(err, elbv2.ErrCodeRuleNotFoundException, "") {
return resource.RetryableError(err)
} else {
return resource.NonRetryableError(err)
}
}
return nil
})

if err != nil {
if isAWSErr(err, elbv2.ErrCodeRuleNotFoundException, "") {
log.Printf("[WARN] DescribeRules - removing %s from state", d.Id())
Expand Down

0 comments on commit cbbf778

Please sign in to comment.