Creating Neo4j vm Terraform Message=“从Marketplace映像创建虚拟机需要在请求中包含计划信息

5sxhfpxr  于 2022-12-12  发布在  其他
关注(0)|答案(2)|浏览(86)

我正在使用的脚本创建Vm从市场给出错误错误:代码=“VMMarketplaceInvalidInput”消息=“从Marketplace映像创建虚拟机要求在请求中包含计划信息。VM:“/订阅/资源组/虚拟机/提供程序/Microsoft.计算/虚拟机/虚拟机””。

provider "azurerm" {
subscription_id = "**************************************"
   features {}
}
# Use existing resource group 
data "azurerm_resource_group" "gepgroup1" {
    name     = "NexxeNeo4j-rg"
}

# Use Existing virtual network
data "azurerm_virtual_network" "gepnetwork1" {
    name                = "DEVRnD"
    resource_group_name = "RnDdev"
}

# Use Existing subnet
data "azurerm_subnet" "gepsubnet" {
    name                 = "subnet"
    resource_group_name  = "RnDdev"
    virtual_network_name = data.azurerm_virtual_network.gepnetwork1.name
}

# Create public IPs NexxeNeo4j
resource "azurerm_public_ip" "geppublicip2" {
    name                         = "NexxeNeo4jPublicIP"
    location                     = "eastus"
    resource_group_name          = "NexxeNeo4j-rg"
    allocation_method            = "Dynamic"

    tags = {
        environment = "Dev-Direct"
    }
}

# Create network interface NexxeNeo4j2
resource "azurerm_network_interface" "gepnic3" {
    name                      = "NexxeNeo4jNIC"
    location                  = "eastus"
    resource_group_name       = "NexxeNeo4j-rg"

    ip_configuration {
        name                          = "NexxeNeo4jConfiguration"
        subnet_id                     = data.azurerm_subnet.gepsubnet.id
        private_ip_address_allocation = "Dynamic"
        public_ip_address_id          = azurerm_public_ip.geppublicip2.id
    }

    tags = {
        environment = "Dev-Direct"
    }
}

# Create virtual machine NexxeNeo4j
resource "azurerm_virtual_machine" "gepvm4" {
    name                  = "NexxeNeo4j"
    location              = "eastus"
    resource_group_name   = "NexxeNeo4j-rg"
    network_interface_ids = [azurerm_network_interface.gepnic3.id]
    vm_size               = "Standard_DS3_v2" 
        plan {
        name= "neo4j_3_5_13_apoc"
        publisher= "neo4j"
        product= "neo4j-enterprise-3_5"
    }
    storage_os_disk {
        name              = "NexxeNeo4j_OsDisk"
        caching           = "ReadWrite"
        create_option     = "FromImage"
        managed_disk_type = "Premium_LRS"
    }

  storage_image_reference {
        publisher = "neo4j"
        offer     = "neo4j-enterprise-3_5"
        sku       = "neo4j_3_5_13_apoc"
        version   = "3.5.13"
    }

    os_profile {
        computer_name  = "NexxeNeo4j"
        admin_username = "gep"
        admin_password = "Nexxegep#07066"
    }
    os_profile_linux_config {
    disable_password_authentication = false
  }

    tags = {
        environment = "Dev-Direct"
    }
}
am46iovg

am46iovg1#

您需要在Terraform HCL脚本中添加PLAN块。
类似于

resource "azurerm_virtual_machine" "gepvm4" {
# ...
 plan {
    publisher = "neo4j"
    name      = "neo4j-enterprise-3_5"
    product   = "neo4j_3_5_13_apoc"
  }
# ...
}
t9aqgxwy

t9aqgxwy2#

我在Azure云shell中尝试了你的配置文件。它确实工作了,除了我需要运行这些Powershell命令来接受法律的条款,然后再运行terraform apply

Get-AzMarketplaceTerms -Publisher neo4j -Product neo4j-enterprise-3_5 -Name neo4j_3_5_13_apoc | Set-AzMarketplaceTerms -Accept -SubscriptionId <subscription-id>

我建议删除terraform.tfstateterraform.tfstate.backup文件,并再次运行terraform init、plan和application。

相关问题