Last active
April 21, 2021 12:53
-
-
Save naumvd95/00bdcd5ef40edc50da05b58c84950f1d to your computer and use it in GitHub Desktop.
Generate random SG rule names in terraform
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
# we already have entities like " resource "openstack_networking_secgroup_rule_v2" "offline_secgroup_rule_extra_" {}" | |
# and want to generate uniq postfixes for them | |
for lineNum in $(grep -Rin "rule_extra" main.tf | cut -f2 -d:); do sed -i '' "${lineNum}s/rule_extra_/rule_extra_$(openssl rand -hex 3)/" main.tf; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment