Closed novohool closed 11 months ago
@novohool Could you please elaborate more about your issue here?
In order to skip resources, there is no mechanism to automatically do that, instead, you can either skip them in interactive mode by select them and press del, or you can generate the resource mapping file and edit the file, then feed it back to the aztfexport map
subcommand.
@novohool Could you please elaborate more about your issue here? 您能在这里详细说明您的问题吗?
In order to skip resources, there is no mechanism to automatically do that, instead, you can either skip them in interactive mode by select them and press del, or you can generate the resource mapping file and edit the file, then feed it back to the
aztfexport map
subcommand.为了跳过资源,没有自动执行此操作的机制,您可以通过选择资源并按 del 以交互模式跳过它们,也可以生成资源映射文件并编辑该文件,然后将其反馈给aztfexport map
子命令。 As shell to useaztfexport config set telemetry_enabled false
az login --service-principal -t $ARM_TENANT_ID -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET >/dev/null 2>&1 mkdir -p json az account list --query "[].{id:id, name:name}" --output json | jq -c '.[]'|grep -v test | while read account; do id=$(echo $account | jq -r '.id') name=$(echo $account | jq -r '.name') export ARM_SUBSCRIPTION_ID="$id" az account set --subscription $ARM_SUBSCRIPTION_ID az group list --subscription $ARM_SUBSCRIPTION_ID --query "[].{rgid:id, rgname:name}" --output json | jq -c '.[]'|egrep -v "test|cloud-shell|DefaultResourceGroup" | while read rg; do mkdir -p ${name} json/${name} rgid=$(echo $rg | jq -r '.rgid') rgname=$(echo $rg | jq -r '.rgname') aztfexport resource-group -f --plain-ui=true --output-dir ${name}/${rgname} --non-interactive --hcl-only ${rgname} (cd ${name}/${rgname} && jq 'with_entries(select(.key | contains("/subscriptions") and contains("Microsoft.ContainerRegistry"))) | keys | unique' aztfexportResourceMapping.json|jq .[]| while read line; do echo "- $line" >> aztfexportSkippedResources.txt; done) sed -i -e '/resource "azurerm_container_registry_scope_map"/,/}/d' ${name}/${rgname}/main.tf sed -i '/admin_password/s/ignored-as-imported/Ignored_AS@Imported888/g' ${name}/${rgname}/main.tf (cd ${name}/${rgname} && terraform init --upgrade && terraform plan -out ${rgname}.out && terraform show -json ${rgname}.out > ../../json/${name}/${rgname}.json) done done az logout
Without more details, we won't be able to resolve this issue, unfortunately @novohool.
The resource azurerm_container_registry_scope_map has unexpect name "_xxx"