Last active
October 2, 2018 02:23
-
-
Save adrienthebo/ce839deec750725af7bc3243d23b1832 to your computer and use it in GitHub Desktop.
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
OUTPUT_OBJECT_PATTERN = re.compile(r""" | |
^output\s+ # Terraform `output` object declaration | |
"(?P<objname>.*?)"\s* # Variable name, within quotes - non-greedy match within quotes | |
\{\s* # Opening brace | |
(?: # Order independent matching of variable fields | |
(?: # Attempt to extract the description field | |
description\s* # Match 'description' literal | |
=\s* # Match '=' literal | |
"(?P<desc>.*?)"\s* # Match and capture quoted string | |
) | |
| | |
(?: # Attempt to extract the value field | |
value\s* # Match 'value' literal | |
=\s* # Match '=' literal | |
"(?P<value>.*?)"\s* # Match and capture quoted string | |
) | |
| | |
.*? # Match and discard other fields | |
){0,2} # Match this group up two two times, letting us perform two passes/captures | |
\s* | |
\}\s* | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment