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

azurerm_data_protection_backup_instance_kubernetes_cluster - fix protection error ScenarioPluginInvalidWorkflowDataRequest and UserErrorKubernetesBackupExtensionUnhealthy #25345

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ func (r DataProtectionBackupInstanceKubernatesClusterResource) Create() sdk.Reso
ResourceType: pointer.To("Microsoft.ContainerService/managedClusters"),
ResourceUri: pointer.To(aksId.ID()),
},
DataSourceSetInfo: &backupinstances.DatasourceSet{
DatasourceType: pointer.To("Microsoft.ContainerService/managedClusters"),
ObjectType: pointer.To("DatasourceSet"),
ResourceID: aksId.ID(),
ResourceLocation: pointer.To(location.Normalize(model.Location)),
ResourceName: pointer.To(aksId.ManagedClusterName),
ResourceType: pointer.To("Microsoft.ContainerService/managedClusters"),
ResourceUri: pointer.To(aksId.ID()),
},
FriendlyName: pointer.To(id.BackupInstanceName),
ObjectType: "BackupInstance",
PolicyInfo: backupinstances.PolicyInfo{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ resource "azurerm_role_assignment" "test_cluster_msi_contributor_on_snap_rg" {
principal_id = azurerm_kubernetes_cluster.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_data_contributor_on_storage" {
scope = azurerm_storage_account.test.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_msi_snapshot_contributor_on_snap_rg" {
scope = azurerm_resource_group.snap.id
role_definition_name = "Disk Snapshot Contributor"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_data_operator_on_snap_rg" {
scope = azurerm_resource_group.snap.id
role_definition_name = "Data Operator for Managed Disks"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_data_protection_backup_policy_kubernetes_cluster" "test" {
name = "acctest-paks-%[1]d"
resource_group_name = azurerm_resource_group.test.name
Expand Down Expand Up @@ -214,8 +232,17 @@ resource "azurerm_data_protection_backup_policy_kubernetes_cluster" "test" {
data_store_type = "OperationalStore"
}
}
}

depends_on = [
azurerm_role_assignment.test_extension_and_storage_account_permission,
azurerm_role_assignment.test_vault_msi_read_on_cluster,
azurerm_role_assignment.test_vault_msi_read_on_snap_rg,
azurerm_role_assignment.test_cluster_msi_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_msi_snapshot_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_data_operator_on_snap_rg,
azurerm_role_assignment.test_vault_data_contributor_on_storage,
]
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
}

Expand Down Expand Up @@ -276,6 +303,12 @@ resource "azurerm_data_protection_backup_instance_kubernetes_cluster" "test" {

depends_on = [
azurerm_role_assignment.test_extension_and_storage_account_permission,
azurerm_role_assignment.test_vault_msi_read_on_cluster,
azurerm_role_assignment.test_vault_msi_read_on_snap_rg,
azurerm_role_assignment.test_cluster_msi_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_msi_snapshot_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_data_operator_on_snap_rg,
azurerm_role_assignment.test_vault_data_contributor_on_storage,
]
}
`, template, data.RandomInteger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ resource "azurerm_role_assignment" "vault_msi_read_on_snap_rg" {
principal_id = azurerm_data_protection_backup_vault.example.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_msi_snapshot_contributor_on_snap_rg" {
scope = azurerm_resource_group.snap.id
role_definition_name = "Disk Snapshot Contributor"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_data_operator_on_snap_rg" {
scope = azurerm_resource_group.snap.id
role_definition_name = "Data Operator for Managed Disks"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "test_vault_data_contributor_on_storage" {
scope = azurerm_storage_account.test.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}

resource "azurerm_role_assignment" "cluster_msi_contributor_on_snap_rg" {
scope = azurerm_resource_group.snap.id
role_definition_name = "Contributor"
Expand Down Expand Up @@ -166,7 +184,13 @@ resource "azurerm_data_protection_backup_instance_kubernetes_cluster" "example"
}

depends_on = [
azurerm_role_assignment.extension_and_storage_account_permission,
azurerm_role_assignment.test_extension_and_storage_account_permission,
azurerm_role_assignment.test_vault_msi_read_on_cluster,
azurerm_role_assignment.test_vault_msi_read_on_snap_rg,
azurerm_role_assignment.test_cluster_msi_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_msi_snapshot_contributor_on_snap_rg,
azurerm_role_assignment.test_vault_data_operator_on_snap_rg,
azurerm_role_assignment.test_vault_data_contributor_on_storage,
]
}
```
Expand Down
Loading