aztfexport
aztfexport copied to clipboard
Documentation on -m/--batch option.
Hello,
I have a populated .aztfyResourceMapping.json
file, how do I structure the command to use this file in batch mode?
Do I include the resource group and use --batch? i.e aztfy rg 'rg_name' --batch ".aztfyResourceMapping.json
Or do I use -m i.e aztfy rg 'rg_name' --m ".aztfyResourceMapping.json"
Or do I exclude i.e aztfy ".aztfyResourceMapping.json"
None of these options are working for me and I would prefer to use the non interactive mode as I had to cull a few items in the mapping.
Thanks.
I've also tried aztfy rg --batch --resource-mapping ".aztfyResourceMapping.json" 'rg_name'
to no success.
@bourbonfgiles The aztfy will remove everything (by default) in the output directory. The .aztfyResourceMapping.json is generated at the output directory, and will be removed at the next run. The correct way of using that file is copy it to another place and then run in either interactive/noninteractive mode:
- Interactively:
aztfy rg 'rg_name' -m ".aztfyResourceMapping.json
- Non-interactively:
aztfy rg 'rg_name' --batch -m ".aztfyResourceMapping.json
@magodo not sure if this might just be my own issue, but currently facing issues with running -m/-b together. Here:
@stemaMSFT Could you please try aztfy rg --batch -m ".aztfyResourceMapping.json" stema-aztfy-demo
?
When the file's in there, it says it can't write because the directory's not empty, and when the file isn't in there, it says it can't find the mapping file:
Yes, you would have to put the mapping file to other folder rather than the output directory.
I realized we can run the command by adding --append, but this feels like it may be unintuitive given the error simply says "the directory is not empty." Any direction to point them towards the append flag if they want their HCL/state to exist in the same directory would help, such as "Error: the output directory " " is not empty. Use --append to write to the directory anyway, or to write to existing state." Thoughts?
The output directory might be an existing TF workspace, that users forgot to add the --append
option. It might also be a non-TF related directory. I think reading through the readme helps more.
:wave:
Since we've not heard back here I'm going to close this issue for the moment. Feel free to reopen if still have questions.