-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
data/source_aws_db_snapshot: Avoid nil pointer when snapshot is still being created #2178
Conversation
This commit set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the provided fix. Just left a comment to discuss before taking any action there :)
aws/data_source_aws_db_snapshot.go
Outdated
d.Set("snapshot_create_time", snapshot.SnapshotCreateTime.Format(time.RFC3339)) | ||
} else { | ||
d.Set("snapshot_create_time", fmt.Sprintf("creating at %s", time.Now().UTC().Format(time.RFC3339))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where SnapshotCreateTime is nil, the attribute is set as a sentence containing the formatted time: this exposes a wrong information to the end user, and is not consistent with the other case, being just a formatted time.
I think we should only check for the case where it is not nil, because we have the correct snapshot creation time. THoughts? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. It's inconsistent with the formatted time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks a lot for the work hre @atsushi-ishibashi :)
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDbSnapshotDataSource_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDbSnapshotDataSource_ -timeout 120m
=== RUN TestAccAWSDbSnapshotDataSource_basic
--- PASS: TestAccAWSDbSnapshotDataSource_basic (594.84s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 594.890s
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
#1794