rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

HCL base recipes and utilities

Open jkschneider opened this issue 2 years ago • 2 comments

  • [x] getAttributeValue(String) / getAttribute(String) on Block
  • [x] withAttributeValue(String, String) on Block
  • [x] JsonPathMatcher for HCL
  • [x] DeleteContent by path (content includes blocks but could also include attributes)
  • [ ] InsertContent by path
  • [ ] MergeContent
  • [x] New file with Block from another
  • [x] FindContent (search recipe)

cc / @nmck257 JsonPathMatcher will be a more fully featured form of getBlockPath().

jkschneider avatar Jul 14 '22 11:07 jkschneider

JsonPathMatcher introduced with df8d8dece8fe40253bc80c75821a836f082321d5

jkschneider avatar Jul 14 '22 11:07 jkschneider

@jkschneider thoughts on JsonPathMatcher support for querying on labels? (didn't think it does currently)

I'm thinking something like $.provider[aws] to match the first block below - or $.resource[foo.bar] to match third block below.

provider "aws" {

}

provider "gcp" {

}

resource "foo" "bar" {

}

Edit - proper jsonpath syntax is probably something like $.provider[?(@.labels = 'aws'] or $.resource[?(@.labels = 'foo.bar'] - labels being a special property to query on

rmadamanchi avatar Jul 20 '22 16:07 rmadamanchi