Hi All,
I am running terraform configuration on Azure Service Management.
But I got an error:
$ terraform apply -state st.state -var instance_size=Large -var image_name=my_image_name -var service_location="West US"
azure_virtual_network.stackvirt1: Creating...
address_space.#: "" => "1"
location: "" => "West US"
name: "" => "stackvirt1"
subnet.#: "" => "2"
subnet.4214968994.security_group: "" => ""
azure_storage_service.stackstorage1: Creating...
account_type: "" => "Standard_LRS"
description: "" => "stack Terraform."
label: "" => "Made by Terraform."
location: "" => "West US"
name: "" => "stackstorage1"
primary_key: "" => "<computed>"
secondary_key: "" => "<computed>"
url: "" => "<computed>"
azure_hosted_service.stackservice1: Creating...
default_certificate_thumbprint: "" => "<computed>"
description: "" => "stack Terraform."
ephemeral_contents: "" => "0"
label: "" => "stack-service1-label"
location: "" => "West US"
name: "" => "stackservice1"
status: "" => "<computed>"
url: "" => "<computed>"
azure_storage_service.stackstorage1: Still creating... (10s elapsed)
...
azure_storage_service.stackstorage1: Still creating... (40s elapsed)
azure_storage_service.stackstorage1: Creation complete
Error applying plan:
1 error(s) occurred:
* azure_virtual_network.stackvirt1: Error creating Virtual Network stackvirt1: Error response from Azure. Code: BadRequest, Message: IP address is not valid ''.
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
Does anybody know what is the problem?
My config:
# Connect to the Azure Provider
provider "azure" {
publish_settings = "${file("XXXXXXXXXXXXXXXXXXXXXXXXX.publishsettings")}"
}
resource "azure_hosted_service" "stackservice1" {
name = "stackservice1"
location = "West US"
ephemeral_contents = false
description = "stack Terraform."
label = "stack-service1-label"
}
resource "azure_storage_service" "stackstorage1" {
name = "stackstorage1"
location = "West US"
description = "stack Terraform."
account_type = "Standard_LRS"
}
resource "azure_virtual_network" "stackvirt1" {
name = "stackvirt1"
location = "West US"
subnet {
name = "private"
}
subnet {
name = "public"
}
}
resource "azure_instance" "stack-dut" {
name = "stack-dut1"
image = "${var.image_name}"
size = "${var.instance_size}"
location = "${var.service_location}"
username = "${var.user_name}"
password = "${var.user_password}"
endpoint {
name = "SSH"
protocol = "tcp"
public_port = 22
private_port = 22
}
}
variable "image_name"{
default = ""
}
variable "instance_size" {
default = ""
}
variable "service_location" {
default = ""
}
variable "image_name"{
default = ""
}
variable "user_name" {
default = "tester"
}
variable "user_password" {
default = "XXXXXXXXXX"
}
-Thanks