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

Error setting Instance Profile on Instance when ARN contains multiple / in v3.29.0 #17719

Closed
dgrizzanti opened this issue Feb 19, 2021 · 3 comments · Fixed by #17734
Closed
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@dgrizzanti
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

v3.29.0 for AWS Provider
v0.14.5 for Terraform

Affected Resource(s)

aws_instance

Terraform Configuration Files

resource "aws_instance" "instance_metrics" {
  ami                         = var.ami_id
  instance_type               = var.instance_type
  iam_instance_profile        = var.instance_profile
  subnet_id                   = var.subnet_id
  vpc_security_group_ids      = concat([var.base_security_group], var.extra_sg_ids)
  user_data                   = data.template_file.user_data.rendered
  associate_public_ip_address = local.vpc_type_toggle.associate_public_ip

  root_block_device {
    volume_type           = var.root_vol_type
    volume_size           = var.root_vol_size
    delete_on_termination = var.vol_delete_on_termination
  }

  lifecycle {
    ignore_changes = [volume_tags]
  }
}

Debug Output

Panic Output

Expected Behavior

Creates instance with desired instance profile passed in by var.instance_profile

Actual Behavior

Terraform apply fails with the following error:

Error: error setting iam_instance_profile: expected 2 resource parts in ARN (arn:aws:iam::xxx:instance-profile/yyy/zzz), got: 3

Where zzz was the name passed in via var.instance_profile

Steps to Reproduce

  1. terraform apply with an instance profile name that has an ARN with multiple / after instance-profile

References

Poking around, I think this new function may be the culprit?

https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/internal/service/iam/arn.go

I was able to reproduce the behavior pulling out that function, passing it an ARN that is formatted as above to re-create the same response.

@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Feb 19, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 19, 2021
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. labels Feb 19, 2021
@anGie44 anGie44 changed the title Error setting Instance Profile on Instance when ARN contains multiple / in v3.2.9.0 Error setting Instance Profile on Instance when ARN contains multiple / in v3.29.0 Feb 19, 2021
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Feb 19, 2021
@anGie44
Copy link
Contributor

anGie44 commented Feb 19, 2021

Relates to changes in #17414

@ghost
Copy link

ghost commented Feb 26, 2021

This has been released in version 3.30.0 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 for triage. Thanks!

@ghost
Copy link

ghost commented Mar 25, 2021

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 as resolved and limited conversation to collaborators Mar 25, 2021
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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants