-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.tf
61 lines (48 loc) · 2.31 KB
/
github.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
data "github_repository" "repos" {
for_each = { for repo in var.github_repos : repo.repository_name => repo }
full_name = "${data.github_organization.current.orgname}/${each.value.repository_name}"
}
resource "github_repository_environment" "azure_environments" {
for_each = { for repo_env in local.repo_environments : repo_env.key => repo_env if repo_env.create_environment }
environment = each.value.environment_name
repository = data.github_repository.repos[each.value.repository_name].name
lifecycle {
ignore_changes = [
wait_timer,
reviewers,
deployment_branch_policy
]
}
}
resource "github_actions_environment_secret" "environment_client_id" {
for_each = { for repo_env in local.repo_environments : repo_env.key => repo_env }
repository = data.github_repository.repos[each.value.repository_name].name
environment = each.value.environment_name
secret_name = "AZURE_CLIENT_ID"
plaintext_value = azuread_application.github_oidc_app.application_id
depends_on = [
github_repository_environment.azure_environments
]
}
resource "github_actions_environment_secret" "environment_subscription_id" {
for_each = { for repo_env in local.repo_environments : repo_env.key => repo_env }
repository = data.github_repository.repos[each.value.repository_name].name
environment = each.value.environment_name
secret_name = "AZURE_SUBSCRIPTION_ID"
plaintext_value = var.subscription_id
depends_on = [
github_repository_environment.azure_environments
]
}
resource "github_actions_secret" "repo_client_id" {
for_each = { for repo in var.github_repos : repo.repository_name => repo if length(repo.branch_names) > 0 || length(repo.tag_names) > 0 || repo.enable_pull_requests }
repository = data.github_repository.repos[each.value.repository_name].name
secret_name = "AZURE_CLIENT_ID"
plaintext_value = azuread_application.github_oidc_app.application_id
}
resource "github_actions_secret" "repo_subscription_id" {
for_each = { for repo in var.github_repos : repo.repository_name => repo if length(repo.branch_names) > 0 || length(repo.tag_names) > 0 || repo.enable_pull_requests }
repository = data.github_repository.repos[each.value.repository_name].name
secret_name = "AZURE_SUBSCRIPTION_ID"
plaintext_value = var.subscription_id
}