Skip to content

Commit eb6f409

Browse files
committed
migrate to hetzner
migrate most google cloud infra to azure use github-azure OIDC authentication
1 parent 4165de4 commit eb6f409

File tree

5 files changed

+101
-32
lines changed

5 files changed

+101
-32
lines changed
File renamed without changes.

terraform/ci_cache_storage.tf renamed to terraform/ci_storage.tf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,37 @@ resource "azurerm_storage_account" "server-edition-ci" {
1111
}
1212
}
1313

14+
15+
resource "azurerm_storage_container" "server-edition-ci-artifacts" {
16+
name = "server-edition-ci-artifacts"
17+
storage_account_name = azurerm_storage_account.server-edition-ci.name
18+
container_access_type = "private"
19+
}
20+
21+
resource "azurerm_storage_management_policy" "server-edition-ci-artifacts-expiry" {
22+
storage_account_id = azurerm_storage_account.server-edition-ci.id
23+
rule {
24+
name = "expire-old-entries"
25+
enabled = true
26+
filters {
27+
prefix_match = ["${azurerm_storage_container.server-edition-ci-artifacts.name}/"]
28+
blob_types = ["blockBlob"]
29+
}
30+
actions {
31+
base_blob {
32+
delete_after_days_since_creation_greater_than = "30"
33+
}
34+
}
35+
}
36+
}
37+
38+
resource "azurerm_role_assignment" "server-edition-ci-artifacts-owned-by-infra-maintainers" {
39+
scope = azurerm_storage_container.server-edition-ci-artifacts.resource_manager_id
40+
role_definition_name = "Storage Blob Data Owner"
41+
principal_id = data.azuread_group.infra-maintainers.id
42+
}
43+
44+
1445
resource "azurerm_storage_container" "server-edition-ci-cache" {
1546
name = "server-edition-ci-cache"
1647
storage_account_name = azurerm_storage_account.server-edition-ci.name

terraform/entra_apps.tf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# resource "google_service_account" "apiserver" {
2+
# depends_on = [google_project_service.iam-api]
3+
# account_id = "apiserver"
4+
# display_name = "API server"
5+
# }
6+
7+
8+
# resource "google_service_account" "infra-ci-bot" {
9+
# depends_on = [google_project_service.iam-api]
10+
# account_id = "infra-ci-bot"
11+
# display_name = "Infrastructure CI bot"
12+
# }
13+
14+
# resource "google_service_account_key" "infra-ci-bot-sa-key" {
15+
# service_account_id = google_service_account.infra-ci-bot.name
16+
# }
17+
18+
19+
# resource "google_service_account" "server-edition-ci-bot" {
20+
# depends_on = [google_project_service.iam-api]
21+
# account_id = "server-edition-ci-bot"
22+
# display_name = "Server Edition CI bot"
23+
# }
24+
25+
# resource "google_service_account_key" "server-editions-ci-bot-sa-key" {
26+
# service_account_id = google_service_account.server-edition-ci-bot.name
27+
# }
28+
29+
data "azuread_group" "infra-maintainers" {
30+
display_name = "Fullstaq Ruby Infra Maintainers"
31+
security_enabled = true
32+
}
33+
34+
35+
resource "azuread_application" "server-edition-github-ci-test" {
36+
display_name = "Server Edition Github CI (test)"
37+
owners = [azuread_group.infra-maintainers.id]
38+
}
39+
40+
resource "azuread_application_federated_identity_credential" "server-edition-github-ci-test" {
41+
application_id = azuread_application_registration.server-edition-github-ci-test.application_id
42+
display_name = "Server Edition Github CI (test)"
43+
audiences = ["api://AzureADTokenExchange"]
44+
issuer = "https://token.actions.githubusercontent.com"
45+
subject = "repo:fullstaq-ruby/server-edition:environment:test"
46+
}
47+
48+
resource "azuread_service_principal" "server-edition-github-ci-test" {
49+
client_id = azuread_application.server-edition-github-ci-test.application_id
50+
owners = [azuread_group.infra-maintainers.id]
51+
}
52+
53+
54+
resource "azuread_application" "server-edition-github-ci-deploy" {
55+
display_name = "Server Edition Github CI (deploy)"
56+
owners = [azuread_group.infra-maintainers.id]
57+
}
58+
59+
resource "azuread_application_federated_identity_credential" "server-edition-github-ci-deploy" {
60+
application_id = azuread_application_registration.server-edition-github-ci-deploy.application_id
61+
display_name = "Server Edition Github CI (deploy)"
62+
audiences = ["api://AzureADTokenExchange"]
63+
issuer = "https://token.actions.githubusercontent.com"
64+
subject = "repo:fullstaq-ruby/server-edition:environment:deploy"
65+
}
66+
67+
resource "azuread_service_principal" "server-edition-github-ci-deploy" {
68+
client_id = azuread_application.server-edition-github-ci-deploy.application_id
69+
owners = [azuread_group.infra-maintainers.id]
70+
}

terraform/resource_groups.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
data "azuread_group" "infra-maintainers" {
2-
display_name = "Fullstaq Ruby Infra Maintainers"
3-
security_enabled = true
4-
}
5-
61
resource "azurerm_resource_group" "infra-maintainers" {
72
name = "fullstaq-ruby-infra-maintainers"
83
location = "westeurope"

terraform/service_accounts.tf

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

0 commit comments

Comments
 (0)