-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2/3] Tag AWS resources created with Terraform (#1552)
- Loading branch information
1 parent
33f1e16
commit 11f1ea0
Showing
11 changed files
with
114,539 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Save Terraform version and schema information to the file specified | ||
in AZUL_TRACKED_SCHEMA_PATH or verify that the Terraform information | ||
in that file is up-to-date. | ||
""" | ||
import argparse | ||
import logging | ||
|
||
from azul import ( | ||
config, | ||
) | ||
from azul.deployment import ( | ||
terraform, | ||
) | ||
from azul.logging import ( | ||
configure_script_logging, | ||
) | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def check_schema_json() -> None: | ||
if terraform.tracked_versions == terraform.versions(): | ||
return | ||
else: | ||
raise RuntimeError('Tracked Terraform schema is out of date. Run `make -C ' | ||
f'terraform schema` and commit {config.tracked_terraform_schema}') | ||
|
||
|
||
if __name__ == '__main__': | ||
configure_script_logging() | ||
commands = { | ||
'generate': terraform.write_tracked_schema, | ||
'check': check_schema_json | ||
} | ||
# https://youtrack.jetbrains.com/issue/PY-41806 | ||
# noinspection PyTypeChecker | ||
parser = argparse.ArgumentParser(description=__doc__, | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument('command', choices=commands) | ||
arguments = parser.parse_args() | ||
commands[arguments.command]() |
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
Oops, something went wrong.