Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spacemk audit write to XLS - Unable to complete if 'tag-names' is a list of emtpy lists #88

Open
jeanvisser opened this issue Jan 28, 2025 · 1 comment

Comments

@jeanvisser
Copy link

jeanvisser commented Jan 28, 2025

When the TF API returns workspaces data, if the 'tag-names' attribute is an empty list, the audit script errors:

TypeError: Unsupported type <class 'list'> in write() .

Traceback: audit_traceback.txt

Example:

curl -s \                           
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  https://app.terraform.io/api/v2/workspaces/{WORKSPACE_ID} | jq ".data.attributes[\"tag-names\"]"
[]

Adding some additional output to the script, the value being passed to xlswriter:
Key, Value of pivoted_entity_type_data.items(): attributes.tag-names: [[], [], [], []].

@jeanvisser
Copy link
Author

jeanvisser commented Jan 28, 2025

Added:

if isinstance(value[0], list):
    break

To https://github.com/spacelift-io/spacelift-migration-kit/blob/main/spacemk/exporters/base.py#L168 as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant