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

Main.tf not created #580

Open
clifpi opened this issue Dec 18, 2024 · 7 comments
Open

Main.tf not created #580

clifpi opened this issue Dec 18, 2024 · 7 comments
Labels
question Further information is requested

Comments

@clifpi
Copy link

clifpi commented Dec 18, 2024

Hello,
We followed the following MS article (https://learn.microsoft.com/en-us/azure/developer/terraform/azure-export-for-terraform/export-resources-hcl?tabs=azure-cli) and ran the command "aztfexport resource-group --non-interactive --hcl-only myResourceGroup" and pointed it to the correct resource group. It only created a provider.tf and terraform.tf. It did not create a main.tf. Additional exception files were also created.
Is there any additional prerequisites or steps that were missed to get the main.tf created with all the resource tf code?

@magodo
Copy link
Collaborator

magodo commented Dec 18, 2024

Could you checkout the content of aztfexportResourceMapping.json and aztfexportSkippedResources.txt. If both are empty, and if you are using azure cli for auth, it mostly means the resoruce group isn't belonging to the default subscription set by your azure cli, in which case you can manually specify the correct subscription by using -s.

@magodo magodo added the question Further information is requested label Dec 18, 2024
@clifpi
Copy link
Author

clifpi commented Dec 19, 2024

Hi,
Thank you for your response. These files (the json and txt) are populated with content and are not empty. We are testing it now with the "az account set" command and empty directory. This has been tested in another environment with no main.tf created. Are there any other suggestions? Thank you.

@clifpi
Copy link
Author

clifpi commented Dec 19, 2024

There has been no successful creation of the main.tf given the instructions above. We have tried multiple times with multiple resource groups. Only provider.tf and terraform.tf get created. Any suggestions?

@magodo
Copy link
Collaborator

magodo commented Dec 19, 2024

Can you share the contents of json and txt files? Also, could you please provide the runtime log (via --log-path <path> and --log-level debug)?

@clifpi
Copy link
Author

clifpi commented Dec 19, 2024 via email

@clifpi
Copy link
Author

clifpi commented Dec 19, 2024 via email

@magodo
Copy link
Collaborator

magodo commented Dec 20, 2024

Please put the options after aztfexport rg.

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

No branches or pull requests

2 participants