# Sentinel Selector Cannot Contain Dash?

**URL:** <https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042>\
**Category:** Sentinel\
**Created:** [January 24, 2024, 1:29pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042 "2024-01-24T13:29:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aisarosenbaum](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/aisarosenbaum/32/39922_2.png) [@aisarosenbaum](https://discuss.hashicorp.com/u/aisarosenbaum)\
**Post date:** [January 24, 2024, 1:29pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042/1 "2024-01-24T13:29:42Z")

</div>

Hi,

I need to be able to select this from terraform apply output:

f = tfplan.module([“modname”]).resources[“resname”].foo-bar[0].applied

That gives me this fatal error:

“unknown identifier accessed: bar”

It’s apparently trying to give ‘-’ special meaning.

A similar selector without a dash works fine:

g = tfplan.module([“modname”]).resources[“resname”].foo[0].applied

How can I select data that contains a dash?

---

<div class="post-metadata">

**Author:** ![kardell2006g](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/kardell2006g/32/30991_2.png) [@kardell2006g](https://discuss.hashicorp.com/u/kardell2006g)\
**Post date:** [January 24, 2024, 3:13pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042/2 "2024-01-24T15:13:50Z")

</div>

use [“foo-bar”]

f = tfplan.module([“modname”]).resources[“resname”][“foo-bar”]

I have a mock demoing usage of selectors here that might help: [Sentinel Playground](https://play.sentinelproject.io/p/08C0TPeUYIr)

---

<div class="post-metadata">

**Author:** ![aisarosenbaum](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/aisarosenbaum/32/39922_2.png) [@aisarosenbaum](https://discuss.hashicorp.com/u/aisarosenbaum)\
**Post date:** [January 24, 2024, 3:48pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042/3 "2024-01-24T15:48:50Z")

</div>

kardell2006g, thanks for the quick response.

But unfortunately, your playground example doesn’t help as I don’t need to access hash keys with dashes. I need to access variables with dashes:

print(tfplan.variables.sub-values

---

<div class="post-metadata">

**Author:** ![aisarosenbaum](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/aisarosenbaum/32/39922_2.png) [@aisarosenbaum](https://discuss.hashicorp.com/u/aisarosenbaum)\
**Post date:** [January 24, 2024, 6:22pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042/4 "2024-01-24T18:22:36Z")

</div>

kardell2006g, my apologies. I didn’t read your response carefully. Using the key works. Thanks.

---

<div class="post-metadata">

**Author:** ![hcrhall](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/hcrhall/32/968_2.png) [@hcrhall](https://discuss.hashicorp.com/u/hcrhall)\
**Post date:** [January 24, 2024, 8:53pm UTC](https://discuss.hashicorp.com/t/sentinel-selector-cannot-contain-dash/62042/5 "2024-01-24T20:53:04Z")

</div>

@aisarosenbaum thanks for reaching out to the community for assistance.

I’ve observed that your policy currently utilizes an outdated version of the `tfplan` import. I’m uncertain whether you’re revising the logic in an existing policy or crafting a new one from the beginning. If it’s the latter, I suggest commencing with the more recent [tfplan/v2](https://developer.hashicorp.com/sentinel/docs/features/terraform/tfplan-v2) import. This choice simplifies the policy authoring process and ensures your policies remain relevant for the upcoming years.
