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

[Bug]: aws_iot_ca_certificate registration_config role_arn type mismatch #35079

Closed
miljanic opened this issue Dec 28, 2023 · 8 comments · Fixed by #35234
Closed

[Bug]: aws_iot_ca_certificate registration_config role_arn type mismatch #35079

miljanic opened this issue Dec 28, 2023 · 8 comments · Fixed by #35234
Labels
bug Addresses a defect in current functionality. service/iot Issues and PRs that pertain to the iot service.
Milestone

Comments

@miljanic
Copy link

Terraform Core Version

1.6.6

AWS Provider Version

5.30.0

Affected Resource(s)

aws_iot_ca_certificate

Expected Behavior

When I provide the role ARN (a string value) to the registration_config.role_arn I expect the aws_iot_ca_certificate resource to be created.

Actual Behavior

I am receiving an error:

Inappropriate value for attribute "role_arn": a bool is required.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

/

Steps to Reproduce

Follow the example from the documentation and add the registration_config block to the aws_iot_ca_certificate resource.

resource "aws_iam_role" "this" {...}
resource "tls_self_signed_cert" "ca" {...}
resource "tls_private_key" "ca" {...}
resource "tls_cert_request" "verification" {...}
resource "tls_private_key" "verification" {...}
resource "tls_locally_signed_cert" "verification" {...}
data "aws_iot_registration_code" "example" {}

resource "aws_iot_ca_certificate" "example" {
  active                       = true
  ca_certificate_pem           = tls_self_signed_cert.ca.cert_pem
  verification_certificate_pem = tls_locally_signed_cert.verification.cert_pem
  allow_auto_registration      = true
  
  registration_config {
    role_arn = aws_iam_role.this.arn
    template_body = "..."
  }
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

I assume this issue is related to the wrong type on the role_arn field in the go code here

"role_arn": {
	Type:         schema.TypeBool,
	Optional:     true,
	ValidateFunc: verify.ValidARN,
},

instead of

"role_arn": {
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: verify.ValidARN,
},

Would you like to implement a fix?

No

@miljanic miljanic added the bug Addresses a defect in current functionality. label Dec 28, 2023
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/iam Issues and PRs that pertain to the iam service. service/iot Issues and PRs that pertain to the iot service. labels Dec 28, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 28, 2023
@WitoldSlawko
Copy link

Hi.

Bumping attention as well for this bug to be fixed:
image

as currently it is blocking setting IoT JITP via Terraform :/

@acwwat
Copy link
Contributor

acwwat commented Jan 10, 2024

I'd like to help but I am having trouble finding information about the registration_config block. I can't find much in the documentation, and I don't see any options (so far) in the AWS Management Console either. While I can simply fix the data type, the best thing to do is to add a test case to validate a scenario with registration_config set.

Could someone please give an exact example of a Terraform config for the registration_config block and also explain what the role ARN is used for (what policy it should have for what service)? Thank you.

@acwwat
Copy link
Contributor

acwwat commented Jan 10, 2024

I think I have what I need after reading up on provisioning template. Since the test case won't be provisioning any devices, I will set up a dummy IOT service role with no policy and a sample JITP template pulled from the AWS doc. They might not work in practice but should be sufficient for testing the Terraform resource.

@WitoldSlawko
Copy link

hi Anthony

thank you for quick response and setting up PR. You are exactly right on the spot. I also check your PR: #35234 , and for me it looks nice and it's good to go :)

@justinretzolk justinretzolk removed service/iam Issues and PRs that pertain to the iam service. needs-triage Waiting for first response or review from a maintainer. labels Jan 11, 2024
@ewbankkit
Copy link
Contributor

Relates #15098.

@github-actions github-actions bot added this to the v5.33.0 milestone Jan 12, 2024
Copy link

This functionality has been released in v5.32.1 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/iot Issues and PRs that pertain to the iot service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants