-
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
Add support aws worklink website certificate authority association resource #7459
Add support aws worklink website certificate authority association resource #7459
Conversation
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 so much @kterada0509! A few little things and this should be good.
Maintainer note: Its a shame the provider resource map change will affect other new resource/data source PRs and that other new resource data source PRs merged in before this will break this one. 😓 I think we have reasons to keep it a static map for other tooling that reads the provider information, but maybe worth reconsidering splitting it up (e.g. per service) so string length changes like this don't cause this problem.
return fmt.Errorf("Error creating WorkLink Website Certificate Authority Association: %s", err) | ||
} | ||
|
||
d.SetId(fmt.Sprintf("%s/%s", aws.StringValue(resp.WebsiteCaId), d.Get("fleet_arn").(string))) |
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.
Two things here:
- I'm not sure if we note this in our contributing documentation anywhere (😅), but by convention across the Terraform AWS provider we prefer to set resource IDs (and therefore their import IDs) where the container ID is first, then the contained ID. So in this case WorkLink Fleet ARN then WorkLink Website CA ID. 👍
- We may want to consider a different separator, e.g. a comma, since the ARN involved contains slashes
d.SetId(fmt.Sprintf("%s/%s", aws.StringValue(resp.WebsiteCaId), d.Get("fleet_arn").(string))) | |
d.SetId(fmt.Sprintf("%s,%s", d.Get("fleet_arn").(string), aws.StringValue(resp.WebsiteCaId))) |
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. I fixed to given format.
if isAWSErr(err, worklink.ErrCodeResourceNotFoundException, "") { | ||
return emptyResp, "DELETED", nil | ||
} | ||
} |
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.
If the error is not worklink.ErrCodeResourceNotFoundException
, we should return the error.
} | |
return nil, "", err | |
} |
For what its worth, we have been slowly trying to move away from the convention of using if isAWSErr()
conditionals inside the if err != nil
conditionals to make this type of coding mistake more obvious, e.g. in this case
if isAWSErr(err, worklink.ErrCodeResourceNotFoundException, "") {
return emptyResp, "DELETED", nil
}
if err != nil {
return nil, "", err
}
Its a bummer this cannot be caught by linting as its a logic problem. 😄
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.
Fixed.
|
||
resource "aws_worklink_website_certificate_authority_association" "test" { | ||
fleet_arn = "${aws_worklink_fleet.test.arn}" | ||
certificate = "${file("test-fixtures/worklink-website-certificate-authority-association.pem")}" |
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.
Nit: We may want to remove the test-fixtures part of this for the example to reduce any confusion 👍
certificate = "${file("certificate.pem")}"
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.
fixed
|
||
## Import | ||
|
||
WorkLink Website Certificate Authority can be imported using `WEBSITE-CA-ID/FLEET-ARN`, e.g. |
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.
Just noting here that when the ID is swapped around, this documentation will also need an update 👍
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.
Fixed.
924ee80
to
dc2d03e
Compare
@bflad
|
aa848ba
to
e60e820
Compare
8041594
to
dedac6f
Compare
dedac6f
to
da8e911
Compare
da8e911
to
1db47d3
Compare
This reverts commit 9e34d984560ff4ec526be7636a06124069bc1b5a.
1db47d3
to
f9b7c07
Compare
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 @kterada0509! 🚀 Apologies in the delay getting back to this and appreciate the recent rebase work.
Output from acceptance testing:
--- PASS: TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_Basic (91.33s)
--- PASS: TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_Disappears (99.38s)
--- PASS: TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_DisplayName (104.30s)
This has been released in version 2.6.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #7330
Changes proposed in this pull request:
aws_worklink_website_certificate_authority_association
resourceOutput from acceptance testing: