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

Add aws_iot_certificate resource #1225

Merged
merged 3 commits into from
Jul 24, 2017

Conversation

AlexMabry
Copy link
Contributor

Add IoT Certificate resource. Code is based on work from @jhedev. This one is super simple.

@grubernaut
Copy link
Contributor

Needs go fmt ran on source files to fix failing tests

@grubernaut grubernaut added enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. labels Jul 24, 2017
Copy link
Contributor

@grubernaut grubernaut left a 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!

}

func resourceAwsIotCertificateRead(d *schema.ResourceData, meta interface{}) error {

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

return err
}

d.Set("arn", out.CertificateDescription.CertificateArn)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

_, err = conn.UpdateCertificate(&iot.UpdateCertificateInput{
CertificateId: aws.String(d.Id()),
NewStatus: aws.String("INACTIVE"),
})
Copy link
Contributor

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?

Copy link
Contributor Author

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?

@AlexMabry
Copy link
Contributor Author

I changed it to prevent changing the CSR, since it requires creating a new cert

Copy link
Contributor

@grubernaut grubernaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@grubernaut grubernaut merged commit 39fb55b into hashicorp:master Jul 24, 2017
@ghost
Copy link

ghost commented Apr 11, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants