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]: IoT Core Provisioning Template Ignores Updates to Pre-Provisioning Hook ARN #37323

Open
PeterBurner opened this issue May 7, 2024 · 2 comments · May be fixed by #37152
Open

[Bug]: IoT Core Provisioning Template Ignores Updates to Pre-Provisioning Hook ARN #37323

PeterBurner opened this issue May 7, 2024 · 2 comments · May be fixed by #37152
Labels
bug Addresses a defect in current functionality. service/iot Issues and PRs that pertain to the iot service.

Comments

@PeterBurner
Copy link

PeterBurner commented May 7, 2024

Terraform Core Version

1.8.2

AWS Provider Version

5.47.0

Affected Resource(s)

  • aws_iot_provisioning_template

Expected Behavior

Changing the value of the pre_provisioning_hook.target_arn property should update the provisioning template.

Actual Behavior

Changing the value of the pre_provisioning_hook.target_arn property does not update the provisioning template. It continues to contain the old ARN, which breaks functionality. Devices cannot be provisioned anymore.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_iam_role" "test" {
  name = "test"

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          Service = "iot.amazonaws.com"
        }
        Action = "sts:AssumeRole"
      }
    ]
  })
}

resource "aws_iam_role_policy_attachment" "test" {
  role       = aws_iam_role.test.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AWSIoTThingsRegistration"
}

resource "aws_iot_provisioning_template" "test" {
  name                  = "test"
  provisioning_role_arn = aws_iam_role.test.arn
  enabled               = true

  template_body = jsonencode({
    Parameters = {
      SerialNumber = { Type = "String" }
    }

    Resources = {
      certificate = {
        Properties = {
          CertificateId = { Ref = "AWS::IoT::Certificate::Id" }
          Status        = "Active"
        }
        Type = "AWS::IoT::Certificate"
      }
    }
  })
}

Steps to Reproduce

  1. Deploy example
  2. Add pre_provisioning_hook { target_arn = "arn:aws:lambda:eu-central-1:000000000000:function:test" } to aws_iot_provisioning_template resource
  3. Deploy again
  4. See that provisioning template is missing pre-provisioning hook

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@PeterBurner PeterBurner added the bug Addresses a defect in current functionality. label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

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 May 7, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 7, 2024
@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 May 7, 2024
@DanielRieske
Copy link
Contributor

Hi @PeterBurner 👋, thanks for reporting this issue, I will fix this as part of the iot SDKv2 migration PR.

@DanielRieske DanielRieske linked a pull request May 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

3 participants