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

Feature Request: Data source to parse an ARN #3995

Closed
ewbankkit opened this issue Mar 30, 2018 · 6 comments · Fixed by #3996
Closed

Feature Request: Data source to parse an ARN #3995

ewbankkit opened this issue Mar 30, 2018 · 6 comments · Fixed by #3996
Labels
new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS.
Milestone

Comments

@ewbankkit
Copy link
Contributor

Add a data source to parse an ARN into its constituent parts.

@bflad
Copy link
Contributor

bflad commented Mar 30, 2018

Can you explain the use case?

@bflad bflad added new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS. waiting-response Maintainers are waiting on response from community or contributor. labels Apr 2, 2018
@barend
Copy link

barend commented Apr 5, 2018

It's a convenient way to get to the account ID and region of any resource. I find myself using this from time to time, for example when constructing an IAM policy document:

foo_arn = "arn:aws:xxx::${element(split(":", data.aws_yyy.zzz.arn), 4)}:foo/bar"

It would help readability if I could use something akin to

data "aws_arn" "xxx" {
  arn = "${data.aws_yyy.zzz.arn}"
}

resource "aws_abc" "abc" {
  foo_arn = "arn:aws:xxx::${data.aws_arn.xxx.account_id}:foo/bar"
}

@catsby catsby removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 5, 2018
@ewbankkit
Copy link
Contributor Author

Yes, my specific use case is some prototype work around the Resource Groups Tagging GetResources API which returns a list of ARNs. I'd like to be able to parse the ARN to extract resource type etc.

@bflad bflad added this to the v1.19.0 milestone May 14, 2018
@bflad
Copy link
Contributor

bflad commented May 14, 2018

This will be released later this week in v1.19.0 of the AWS provider.

@bflad
Copy link
Contributor

bflad commented May 17, 2018

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

@ghost
Copy link

ghost commented Apr 6, 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 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants