Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion project_setup/scripts/terraform-to-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ def parse_tagged_resources(
) -> Generator[Tuple[str, str], None, None]:
"""Search all resources for tags requesting the creation of a secret."""
for resource in find_resources(terraform_state, None):
tags: Dict[str, str] = resource["values"].get("tags", dict())
# Ensure "tags" key exists in resource["values"] and if it does,
# make sure its value is not None. Both of these cases can occur.
tags: Dict[str, str]
if "tags" not in resource["values"] or resource["values"].get("tags") is None:
tags = dict()
else:
tags = resource["values"]["tags"]
secret_name: Optional[str] = tags.get(GITHUB_SECRET_NAME_TAG)
lookup_tag: Optional[str] = tags.get(GITHUB_SECRET_TERRAFORM_LOOKUP_TAG)
secret_value: str
Expand Down