|
| 1 | +/* |
| 2 | +Copyright 2024 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +variable "resource_group_name" { |
| 18 | + type = string |
| 19 | +} |
| 20 | + |
| 21 | +variable "location" { |
| 22 | + type = string |
| 23 | +} |
| 24 | + |
| 25 | +# Create the "cluster-api-gallery" resource group |
| 26 | +resource "azurerm_resource_group" "cluster-api-gallery" { |
| 27 | + location = var.location |
| 28 | + name = var.resource_group_name |
| 29 | + tags = { |
| 30 | + DO-NOT-DELETE = "UpstreamInfra" |
| 31 | + creationTimestamp = "2024-10-24T00:00:00Z" |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +# Create the shared image gallery with community permissions |
| 36 | +resource "azurerm_shared_image_gallery" "community_gallery" { |
| 37 | + description = "Shared image gallery for Cluster API Provider Azure" |
| 38 | + location = var.location |
| 39 | + name = "community_gallery" |
| 40 | + resource_group_name = "cluster-api-gallery" |
| 41 | + tags = { |
| 42 | + creationTimestamp = "2024-10-24T00:00:00Z" |
| 43 | + jobName = "image-builder-sig-ubuntu-2404" |
| 44 | + } |
| 45 | + sharing { |
| 46 | + permission = "Community" |
| 47 | + community_gallery { |
| 48 | + eula = "https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/LICENSE" |
| 49 | + prefix = "ClusterAPI" |
| 50 | + publisher_email = "[email protected]" |
| 51 | + publisher_uri = "https://github.com/kubernetes-sigs/cluster-api-provider-azure" |
| 52 | + } |
| 53 | + } |
| 54 | + depends_on = [ |
| 55 | + azurerm_resource_group.cluster-api-gallery, |
| 56 | + ] |
| 57 | +} |
| 58 | + |
| 59 | +# Create the user-assigned identity for publishing with ADO pipelines |
| 60 | +resource "azurerm_user_assigned_identity" "pipelines_user_identity" { |
| 61 | + location = var.location |
| 62 | + name = "ado-pipeline-mi" |
| 63 | + resource_group_name = var.resource_group_name |
| 64 | + tags = { |
| 65 | + creationTimestamp = "2024-10-24T00:00:00Z" |
| 66 | + } |
| 67 | + depends_on = [ |
| 68 | + azurerm_resource_group.cluster-api-gallery, |
| 69 | + ] |
| 70 | +} |
0 commit comments