Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_lb_listener_rule: Add eventualy consistent read after creation #6154

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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