我在Azure上有一个现有的资源组,其上运行了一个VM,并且一直在使用Terraform来尝试将资源导入到我的状态文件中.
我已经设置了一个框架文件,据我所知,一旦我导入TF应该使用Azure中我的资源组中的值填充它
resource "azurerm" "example" {
# ...instance configuration...
name = "MyResourceGroup"
}
Run Code Online (Sandbox Code Playgroud)
命令我从CLI运行:
terraform import azurerm_resource_group.MyResourceGroup/subscriptions/MySubscriptionNumber/resourceGroups/MyResourceGroup
Run Code Online (Sandbox Code Playgroud)
来自Terraform的消息:
The import command expects two arguments.
Usage: terraform import [options] ADDR ID
Import existing infrastructure into your Terraform state.
This will find and import the specified resource into your Terraform
state, allowing existing infrastructure to come under Terraform
management without having to be initially created by Terraform.
The ADDR specified is the address to import the resource to. Please
see the documentation …Run Code Online (Sandbox Code Playgroud) azure azure-virtual-machine terraform terraform-provider-azure
我是 Packer 新手,我一直在尝试按照本指南在 Azure 映像上构建我的第一个 Packer - https://learn.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-包装工
我没有完全遵循该指南,因为我已经设置了 Azure 订阅和资源组。但是现在当我尝试构建我的 Packer 映像时,出现以下错误
Build 'azure-arm' errored: Cannot locate the managed image resource group myResourceGroup
Run Code Online (Sandbox Code Playgroud)
通过阅读文档,它指出唯一的要求是资源组已经存在,正如我在 Azure 门户中看到的那样。
我的打包器 json 文件遵循如下所示的指南中的文件,任何帮助表示赞赏
{
"builders": [{
"type": "azure-arm",
"client_id": "0831b578-8ab6-40b9-a581-9a880a94aab1",
"client_secret": "P@ssw0rd!",
"tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"subscription_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"object_id": "a7dfb070-0d5b-47ac-b9a5-cf214fff0ae2",
"managed_image_resource_group_name": "myResourceGroup",
"managed_image_name": "myPackerImage",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "3m",
"winrm_username": "packer",
"azure_tags": {
"dept": "Engineering",
"task": "Image deployment"
},
"location": "East US",
"vm_size": "Standard_DS2_v2" …Run Code Online (Sandbox Code Playgroud)