aws-cloudformation / aws-cloudformation/cloudformation-guard

[Enhancement] Add support to retrieve the key of a given node

Open
#476 4 comments 9 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
1.4k
Forks
196
Avg merge
3d 6h
Merged PRs (30d)
5

Description

**Is your feature request related to a problem? Please describe.**

Currently users are unable to retrieve the key of a given node. This is especially troublesome when working with cfn templates, and users want to operate on logical id(s). Currently there are some workarounds to achieve this [(see this example from the registry)](https://github.com/aws-cloudformation/aws-guard-rules-registry/blob/main/rules/aws/elastic_load_balancing_v2/elbv2_acm_certificate_required.guard), but it doesnt support all use cases.

**Describe the solution you'd like**

A function that provides the key of for a node(s). ex

```
let buckets = Resources.*[ type == "AWS::S3::Bucket" ]

%buckets {
let bucket_key = key(this)
# do something with key
}
```

**Additional context**
#267

Contributor guide

Open the contributing guide

Research direction

Start by reviewing issue #267 and the linked registry example to understand the existing workarounds for retrieving logical IDs. Define what key(this) should return for a node or set of nodes, then verify that the requested example can operate on bucket keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.