Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Shared Image Galleries #1986

Closed
tombuildsstuff opened this issue Sep 27, 2018 · 6 comments
Closed

Feature Request: Shared Image Galleries #1986

tombuildsstuff opened this issue Sep 27, 2018 · 6 comments

Comments

@tombuildsstuff
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Shared Image Galleries have recently been announced (more info) - which Terraform should support.

New or Affected Resource(s)

  • azurerm_shared_image_gallery
  • azurerm_shared_image
  • azurerm_shared_image_version

Potential Terraform Configuration

resource "azurerm_resource_group" "test" {
  # ...
}


data "azurerm_image" "test" {
  # ...
}


resource "azurerm_shared_image_gallery" "test" {
  name                = "mygallery"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
}

resource "azurerm_shared_image" "test" {
  name                = "example"
  gallery_name        = "${azurerm_shared_image_gallery.test.name}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
  os_type             = "Linux"

  identifier {
    publisher = "ExamplePublisher"
    offer     = "ExampleOffer"
    sku       = "ExcitingSku"
  }
}

resource "azurerm_shared_image_version" "test" {
  name                = "0.0.1"
  gallery_name        = "${azurerm_shared_image_gallery.test.name}"
  image_name          = "${azurerm_shared_image.test.name}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
  managed_image_id    = "${data.azurerm_image.test.id}"
  regions             = ["${azurerm_resource_group.test.location}"]
}

References

@steffencircle
Copy link

You guys rock !

Just saw the announcement and headed over here to raise a feature request for this. But I am already too late :-)

As always looking forward to this !

@tombuildsstuff
Copy link
Contributor Author

hey @lw81

Just to let you know that support for this has now landed in v1.16 of the AzureRM Provider (here's the full changelog](https://github.com/terraform-providers/terraform-provider-azurerm/blob/v1.16.0/CHANGELOG.md)). You can upgrade to to this version by specifying it in your provider block:

provider "azurerm" {
  version = "=1.16.0"
}

... and then running terraform init -upgrade :)

Thanks!

@steffencircle
Copy link

Hi guys,

i am trying to deploy from a Shared Image agllery for the first time now, but i am a bit confused by looking at the docs.

The purpose of using Shared Image Galleries for us is to deploy from a central image repo accross all our subscriptions.
But looking at the data sources for shared_image and shared_image_version etc. there seems to be no way of specifying where this gallery actually is (the subscription)

Am i missing something ?

Steffen

@tombuildsstuff
Copy link
Contributor Author

hey @lw81

You can achieve this by using multiple instances of a Provider (also known as Aliasing Providers) - there's some more information on this here.

This'd look something like this:

provider "azurerm" {
  version =  "=1.19.0"
  subscription_id = "00000000-0000-0000-0000-000000000000"
  alias = "primary"
}

provider "azurerm" {
  version =  "=1.19.0"
  subscription_id = "11111111-1111-1111-1111-111111111111"
  alias = "secondary"
}

"azurerm_shared_image_version" "test" {
  name                = "1.0.0"
  image_name          = "my-image"
  gallery_name        = "my-image-gallery"
  resource_group_name = "example-resources"
  provider = "azurerm.primary"
}

resource "azurerm_virtual_machine" "test" {
  # ...
  provider = "azurerm.secondary"
}

Thanks!

@steffencircle
Copy link

As always, you guys rock :-)
I will give this a try

Many thanks

@ghost
Copy link

ghost commented Mar 5, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants