-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-repo.tf
36 lines (31 loc) · 1.26 KB
/
gh-repo.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
data "github_repository" "main" {
full_name = "DevStarOps-org/Managing-GitHub-secrets-using-terraform"
}
resource "github_repository_environment" "main" {
environment = var.environment_name
repository = data.github_repository.main.id
reviewers {
users = var.environment_name == "production" ? [data.github_user.current.id] : null
}
}
# ARM_CLIENT_ID
resource "github_actions_environment_secret" "ARM_CLIENT_ID" {
repository = data.github_repository.main.id
environment = github_repository_environment.main.environment
secret_name = "ARM_CLIENT_ID"
plaintext_value = azuread_application.main.application_id
}
# ARM_TENANT_ID
resource "github_actions_environment_secret" "ARM_TENANT_ID" {
repository = data.github_repository.main.id
environment = github_repository_environment.main.environment
secret_name = "ARM_TENANT_ID"
plaintext_value = data.azurerm_client_config.current.tenant_id
}
# ARM_SUBSCRIPTION_ID
resource "github_actions_environment_secret" "ARM_SUBSCRIPTION_ID" {
repository = data.github_repository.main.id
environment = github_repository_environment.main.environment
secret_name = "ARM_SUBSCRIPTION_ID"
plaintext_value = data.azurerm_client_config.current.subscription_id
}