使用 Terraform.io 在 Azure 上创建 Ubuntu 服务器资源
Create Ubuntu Server resource on Azure with Terraform.io
我真的很喜欢Terraform.io,我想在我的新项目中采用它。
我正在尝试使用 Terraform 在我的 Azure 订阅上部署一个 Ubuntu 服务器。
我创建了一个包含以下内容的 example.tf 文件:
# Configure Azure provider
provider "azure" {
publish_settings = "${file("credentials.publishsettings")}"
}
# Create web server
resource "azure_instance" "web" {
image = "Ubuntu Server 16.04 LTS"
location = "ukwest"
name = "some_name"
size = "A0"
username = "some_user"
}
当我运行
terraform apply
我收到这个错误:
* azure_instance.web: When using a platform image, the 'storage' parameter is required
所以我尝试在资源元素中添加一个存储参数,像这样:
# Create web server
resource "azure_instance" "web" {
image = "Ubuntu Server 16.04 LTS"
storage = "abc"
location = "ukwest"
name = "cloudlabs"
size = "A0"
username = "cloudlabs"
}
但随后我收到另一条错误消息:
* azure_instance.web: : invalid or unknown key: storage
...我被困在这里。我可能做错了一些非常明显的错误,因为这是我的第一个 tf 文件。欢迎任何想法!
我不是 Azure 用户,但只要我看到文档,它看起来像 storage_service_name
而不是 storage
。
参见:https://www.terraform.io/docs/providers/azure/r/instance.html#storage_service_name
我真的很喜欢Terraform.io,我想在我的新项目中采用它。
我正在尝试使用 Terraform 在我的 Azure 订阅上部署一个 Ubuntu 服务器。
我创建了一个包含以下内容的 example.tf 文件:
# Configure Azure provider
provider "azure" {
publish_settings = "${file("credentials.publishsettings")}"
}
# Create web server
resource "azure_instance" "web" {
image = "Ubuntu Server 16.04 LTS"
location = "ukwest"
name = "some_name"
size = "A0"
username = "some_user"
}
当我运行
terraform apply
我收到这个错误:
* azure_instance.web: When using a platform image, the 'storage' parameter is required
所以我尝试在资源元素中添加一个存储参数,像这样:
# Create web server
resource "azure_instance" "web" {
image = "Ubuntu Server 16.04 LTS"
storage = "abc"
location = "ukwest"
name = "cloudlabs"
size = "A0"
username = "cloudlabs"
}
但随后我收到另一条错误消息:
* azure_instance.web: : invalid or unknown key: storage
...我被困在这里。我可能做错了一些非常明显的错误,因为这是我的第一个 tf 文件。欢迎任何想法!
我不是 Azure 用户,但只要我看到文档,它看起来像 storage_service_name
而不是 storage
。
参见:https://www.terraform.io/docs/providers/azure/r/instance.html#storage_service_name