【问题标题】:How to import resource that has parenthesis in the resource id?如何导入资源ID中带括号的资源?
【发布时间】:2020-11-14 04:46:30
【问题描述】:

我正在尝试使用以下资源 ID 导入此现有 Azure SQL Analytics 解决方案:

/subscriptions/abcfe54c-ae03-45f1-b2e2-d37f04b2fdef/resourcegroups/e1us-dev-rg-01/providers/Microsoft.OperationsManagement/solutions/AzureSQLAnalytics(cts-e1us-dev-la-01)

使用

terraform import azurerm_log_analytics_solution.solution[\`"e1us\`"] /subscriptions/abcfe54c-ae03-45f1-b2e2-d37f04b2fdef/resourcegroups/e1us-dev-rg-01/providers/Microsoft.OperationsManagement/solutions/AzureSQLAnalytics(cts-e1us-dev-la-01)

我得到以下输出:

cts-e1us-dev-la-01: The term 'cts-e1us-dev-la-01' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我应该如何处理括号内的最后一部分?

【问题讨论】:

    标签: terraform terraform-provider-azure


    【解决方案1】:

    尝试转义括号

    例如

    terraform import azurerm_log_analytics_solution.solution[\`"e1us\`"] /subscriptions/abcfe54c-ae03-45f1-b2e2-d37f04b2fdef/resourcegroups/e1us-dev-rg-01/providers/Microsoft.OperationsManagement/solutions/AzureSQLAnalytics\(cts-e1us-dev-la-01\)
    

    或用引号括起来

    terraform import azurerm_log_analytics_solution.solution[\`"e1us\`"] "/subscriptions/abcfe54c-ae03-45f1-b2e2-d37f04b2fdef/resourcegroups/e1us-dev-rg-01/providers/Microsoft.OperationsManagement/solutions/AzureSQLAnalytics(cts-e1us-dev-la-01)"
    

    听起来 shell 正在尝试打开一个子 shell。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-16
      • 1970-01-01
      • 2014-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 2012-01-01
      相关资源
      最近更新 更多