-
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 aws_iot_certificate resource #1225
Conversation
Needs |
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.
Overall looks good, couple of minor nits + questions. Thanks for the contribution!
aws/resource_aws_iot_certificate.go
Outdated
} | ||
|
||
func resourceAwsIotCertificateRead(d *schema.ResourceData, meta interface{}) error { | ||
|
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.
Extra line after function header
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.
ok
aws/resource_aws_iot_certificate.go
Outdated
return err | ||
} | ||
|
||
d.Set("arn", out.CertificateDescription.CertificateArn) |
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.
is active
also returned from the DescribeCertificate
API call? If so, we need to set that here as well, to be able to catch any diffs between infra+state.
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.
ok
aws/resource_aws_iot_certificate.go
Outdated
_, err = conn.UpdateCertificate(&iot.UpdateCertificateInput{ | ||
CertificateId: aws.String(d.Id()), | ||
NewStatus: aws.String("INACTIVE"), | ||
}) |
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 I'm reading this correctly, if a user updates the csr
, Terraform will create a new certificate resource, and leak the existing one? Should we delete the original certificate here as well?
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.
There is really no way to update the csr in API. Would it be more straightforward to delete the old one or just not allow changing it in the first place?
I changed it to prevent changing the CSR, since it requires creating a new cert |
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!
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! |
Add IoT Certificate resource. Code is based on work from @jhedev. This one is super simple.