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

Update aztft to allow VM resolving fallback to azurerm_virtual_machine #425

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Jul 10, 2023

Fix #412

@magodo magodo added the bug Something isn't working label Jul 10, 2023
@magodo magodo merged commit 13fe97e into Azure:main Jul 10, 2023
7 checks passed
@JavierCCC
Copy link

Testing main again (VM with nil osProfile, Windows or Linux):

_../go/bin/aztfexport query --continue --non-interactive --recursive 'type =~ "microsoft.c
ompute/virtualmachines" and name =~ "XXXXXX"'
Error: parallel importing: 2 errors occurred:
* task handler error: failed to merge state file: 1 error occurred:
* showing state file /tmp/aztfexport-779564393/terraform.tfstate: exit status 1

Error: Invalid expression

on import.tf line 3, in import:
3: to = .res-0

Expected the start of an expression, but found an invalid expression token.

Error: Invalid expression

on import.tf line 3, in import:
3: to = .res-0

A single static variable reference is required: only attribute access and
indexing with constant keys. No calculations, function calls, template
expressions, etc are allowed here.

    * task handler error: failed to merge state file: 1 error occurred:
    * showing state file /tmp/aztfexport-33589141/terraform.tfstate: exit status 1

Error: Invalid expression

on import.tf line 3, in import:
3: to = .res-0

Expected the start of an expression, but found an invalid expression token.

Error: Invalid expression

on import.tf line 3, in import:
3: to = .res-0

A single static variable reference is required: only attribute access and
indexing with constant keys. No calculations, function calls, template
expressions, etc are allowed here._

Running fine with VMs with no nil osProfile (Linux or Windows).

@magodo
Copy link
Collaborator Author

magodo commented Jul 11, 2023

@JavierCCC What is the result when you run aztft -api <resource id> on that problematic resource? (you can install aztft by go install github.com/magodo/aztft@main).

BTW, do you know how can I create a legacy VM that have a OS disk attached, so that I can reproduce this locally?

I've figured out the cause, will commit the fixes soon.

@magodo
Copy link
Collaborator Author

magodo commented Jul 11, 2023

@JavierCCC It should work now, please take another try! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nil OS profile in response - Cannot export VMs (but able to export other resources types)
2 participants