Created
September 14, 2023 13:37
-
-
Save maravedi/69be8973beb0de9b732ecfed508cb015 to your computer and use it in GitHub Desktop.
VScode Find and Replace Terraform Plan Output Grossness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The idea behind this is that you can do a terraform plan -out test.tfplan and then take the output that's printed | |
// and copy/paste it into your code, then use these commands to clean it up so it's usable code. | |
// In newer versions of Terraform you can do a terraform plan -generate-config to do this a different way, so check that out too. | |
// Uses this exctension: https://marketplace.visualstudio.com/items?itemName=ArturoDent.find-and-transform&ssr=false#overview | |
"findInCurrentFile": { | |
"replaceHyphenPrefix": { | |
"title": "Replace Terraform Plan output hyphen prefix...", // will appear in the Command Palette | |
"find": "^(\\s+)- ", | |
"replace": "$1", | |
"isRegex": true, | |
"restrictFind": "selections", // default is entire document | |
}, | |
"replaceNullSuffix": { | |
"title": "Replace Terraform Plan output -> null suffix...", // will appear in the Command Palette | |
"find": "\\s->\\snull$", | |
"replace": "", | |
"isRegex": true, | |
"restrictFind": "selections", // default is entire document | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment