0

Is there a way to pass the URN of an Azure image to storage_image_reference instead of using Publisher, Offer, and SKU separately?

For example. passing this

OpenLogic:CentOS:7.5:latest

instead of

storage_image_reference {
  publisher = "OpenLogic"
  offer     = "CentOS"
  sku       = "7.5"
  version   = "latest"
}
0

1 Answer 1

1

Assuming terraform 0.11

variable "urn" {
  type = "list"
}

urn = split(":", "OpenLogic:CentOS:7.5:latest")

...

storage_image_reference {
  publisher = "${urn[0]}"
  offer     = "${urn[1]}"
  sku       = "${urn[2]}"
  version   = "${urn[3]}"
}

Sign up to request clarification or add additional context in comments.

3 Comments

Is there a way to provide multiple Linux flavors with just the one variable?
you could use a list of strings, then perform the split within the storage_image_reference using count to rotate through?
yeah that might work. With the addition of more conditionals, it seems like .12 might be the way to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.