Skip to content

Commit 5f80a97

Browse files
committed
Revert "Merge pull request #7642 from AnnaZivkovic/azure_duplicate_image_gallery"
This reverts commit e2504ab, reversing changes made to 04a22e6.
1 parent 0de586a commit 5f80a97

File tree

10 files changed

+104
-251
lines changed

10 files changed

+104
-251
lines changed

data/data/azure/bootstrap/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ provider "azurerm" {
1717
}
1818

1919
data "azurerm_storage_account" "storage_account" {
20-
name = azurerm_storage_account.cluster.name
20+
name = var.storage_account_name
2121
resource_group_name = var.resource_group_name
2222
}
2323

@@ -57,13 +57,13 @@ data "azurerm_storage_account_sas" "ignition" {
5757

5858
resource "azurerm_storage_container" "ignition" {
5959
name = "ignition"
60-
storage_account_name = azurerm_storage_account.cluster.name
60+
storage_account_name = var.storage_account_name
6161
}
6262

6363
resource "azurerm_storage_blob" "ignition" {
6464
name = "bootstrap.ign"
6565
source = var.ignition_bootstrap_file
66-
storage_account_name = azurerm_storage_account.cluster.name
66+
storage_account_name = var.storage_account_name
6767
storage_container_name = azurerm_storage_container.ignition.name
6868
type = var.azure_keyvault_key_name != "" ? "Page" : "Block"
6969
}
@@ -223,7 +223,7 @@ resource "azurerm_linux_virtual_machine" "bootstrap" {
223223
}
224224

225225
# Either source_image_id or source_image_reference must be defined
226-
source_image_id = azurerm_shared_image_version.bootstrap_image_version.id
226+
source_image_id = ! var.azure_use_marketplace_image ? var.vm_image : null
227227

228228
dynamic "source_image_reference" {
229229
for_each = var.azure_use_marketplace_image ? [1] : []
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
output "bootstrap_ip" {
22
value = var.azure_private ? azurerm_network_interface.bootstrap.private_ip_address : azurerm_public_ip.bootstrap_public_ip_v4[0].ip_address
33
}
4-
5-
output "storage_account_id" {
6-
value = azurerm_storage_account.cluster.id
7-
}
8-
9-
output "storage_rhcos_image_url" {
10-
value = azurerm_storage_blob.rhcos_image.url
11-
}
12-

data/data/azure/bootstrap/storage.tf

Lines changed: 0 additions & 89 deletions
This file was deleted.

data/data/azure/bootstrap/variables.tf

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,14 @@ variable "resource_group_name" {
3737
description = "The resource group name for the deployment."
3838
}
3939

40-
variable "image_version_gallery_name" {
40+
variable "storage_account_name" {
4141
type = string
42-
description = "The name of the image gallery used to set up shared images."
42+
description = "the name of the storage account for the cluster. It can be used for boot diagnostics."
4343
}
4444

45-
variable "image_version_gen2_gallery_name" {
45+
variable "vm_image" {
4646
type = string
47-
description = "The name of the gen2 image gallery used to set up shared images."
48-
}
49-
50-
variable "image_version_name" {
51-
type = string
52-
description = "The name of shared image used to set up shared images."
53-
}
54-
55-
variable "image_version_gen2_name" {
56-
type = string
57-
description = "The name of the gen2 shared image used to set up shared images."
47+
description = "The resource id of the vm image used for bootstrap."
5848
}
5949

6050
variable "identity" {

data/data/azure/cluster/main.tf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module "master" {
2525
vm_size = var.azure_master_vm_type
2626
disk_encryption_set_id = var.azure_master_disk_encryption_set_id
2727
encryption_at_host_enabled = var.azure_master_encryption_at_host_enabled
28+
vm_image = var.vm_image
2829
identity = var.identity
2930
ignition = var.ignition_master
3031
elb_backend_pool_v4_id = var.elb_backend_pool_v4_id
@@ -52,16 +53,6 @@ module "master" {
5253
secure_boot = var.azure_master_secure_boot
5354
virtualized_trusted_platform_module = var.azure_master_virtualized_trusted_platform_module
5455

55-
storage_account_id = var.storage_account_id
56-
storage_rhcos_image_url = var.storage_rhcos_image_url
57-
image_version_gallery_name = var.image_version_gallery_name
58-
image_version_gen2_gallery_name = var.image_version_gen2_gallery_name
59-
image_version_name = var.image_version_name
60-
image_version_gen2_name = var.image_version_gen2_name
61-
azure_image_release = var.azure_image_release
62-
azure_region = var.azure_region
63-
azure_hypervgeneration_version = var.azure_hypervgeneration_version
64-
6556
use_ipv4 = var.use_ipv4
6657
use_ipv6 = var.use_ipv6
6758
}

data/data/azure/cluster/master/master.tf

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,6 @@ locals {
44
ip_v4_configuration_name = "pipConfig"
55
// TODO: Azure machine provider probably needs to look for pipConfig-v6 as well (or a different name like pipConfig-secondary)
66
ip_v6_configuration_name = "pipConfig-v6"
7-
8-
vm_image = var.azure_hypervgeneration_version == "V2" ? azurerm_shared_image_version.clustergen2_image_version.id : azurerm_shared_image_version.cluster_image_version.id
9-
10-
}
11-
resource "azurerm_shared_image_version" "cluster_image_version" {
12-
name = var.azure_image_release
13-
gallery_name = var.image_version_gallery_name
14-
image_name = var.image_version_name
15-
resource_group_name = var.resource_group_name
16-
location = var.azure_region
17-
18-
blob_uri = var.storage_rhcos_image_url
19-
storage_account_id = var.storage_account_id
20-
21-
target_region {
22-
name = var.azure_region
23-
regional_replica_count = 1
24-
}
25-
26-
tags = var.azure_extra_tags
27-
}
28-
29-
resource "azurerm_shared_image_version" "clustergen2_image_version" {
30-
name = var.azure_image_release
31-
gallery_name = var.image_version_gen2_gallery_name
32-
image_name = var.image_version_gen2_name
33-
resource_group_name = var.resource_group_name
34-
location = var.azure_region
35-
36-
blob_uri = var.storage_rhcos_image_url
37-
storage_account_id = var.storage_account_id
38-
39-
target_region {
40-
name = var.azure_region
41-
regional_replica_count = 1
42-
}
43-
44-
tags = var.azure_extra_tags
457
}
468

479
resource "azurerm_network_interface" "master" {
@@ -162,7 +124,8 @@ resource "azurerm_linux_virtual_machine" "master" {
162124
}
163125

164126
# Either source_image_id or source_image_reference must be defined
165-
source_image_id = ! var.use_marketplace_image ? local.vm_image : null
127+
source_image_id = ! var.use_marketplace_image ? var.vm_image : null
128+
166129
dynamic "source_image_reference" {
167130
for_each = var.use_marketplace_image ? [1] : []
168131

data/data/azure/cluster/master/variables.tf

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,46 +27,9 @@ variable "encryption_at_host_enabled" {
2727
description = "Enables encryption at the VM host."
2828
}
2929

30-
variable "storage_account_id" {
30+
variable "vm_image" {
3131
type = string
32-
description = "The storage account ID for the cluster. It can be used for boot diagnostics"
33-
}
34-
35-
variable "storage_rhcos_image_url" {
36-
type = string
37-
description = "The rhcos image url used to identify the vm image for bootstrap and cluster."
38-
}
39-
40-
variable "image_version_gallery_name" {
41-
type = string
42-
description = "The name of the image gallery used to set up shared images."
43-
}
44-
45-
variable "image_version_gen2_gallery_name" {
46-
type = string
47-
description = "The name of the gen2 image gallery used to set up shared images."
48-
}
49-
50-
variable "image_version_name" {
51-
type = string
52-
description = "The name of shared image used to set up shared images."
53-
}
54-
55-
variable "image_version_gen2_name" {
56-
type = string
57-
description = "The name of the gen2 shared image used to set up shared images."
58-
}
59-
60-
variable "azure_region" {
61-
type = string
62-
}
63-
64-
variable "azure_image_release" {
65-
type = string
66-
}
67-
68-
variable "azure_hypervgeneration_version" {
69-
type = string
32+
description = "The resource id of the vm image used for masters."
7033
}
7134

7235
variable "use_marketplace_image" {

data/data/azure/cluster/variables.tf

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,9 @@ variable "resource_group_name" {
6262
description = "The resource group name for the deployment."
6363
}
6464

65-
variable "storage_account_id" {
65+
variable "vm_image" {
6666
type = string
67-
description = "The storage account ID for the cluster. It can be used for boot diagnostics"
68-
}
69-
70-
variable "storage_rhcos_image_url" {
71-
type = string
72-
description = "The rhcos image url used to identify the vm image for bootstrap and cluster."
73-
}
74-
75-
variable "image_version_gallery_name" {
76-
type = string
77-
description = "The name of the image gallery used to set up shared images."
78-
}
79-
80-
variable "image_version_gen2_gallery_name" {
81-
type = string
82-
description = "The name of the gen2 image gallery used to set up shared images."
83-
}
84-
85-
variable "image_version_name" {
86-
type = string
87-
description = "The name of shared image used to set up shared images."
88-
}
89-
90-
variable "image_version_gen2_name" {
91-
type = string
92-
description = "The name of the gen2 shared image used to set up shared images."
67+
description = "The resource id of the vm image used for bootstrap."
9368
}
9469

9570
variable "identity" {

0 commit comments

Comments
 (0)