Skip to content
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
## Requirements

| Name | Version |
|------|---------|
| ---- | ------- |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 1.3 |
| <a name="requirement_github"></a> [github](#requirement\_github) | ~> 6.0 |

## Providers

| Name | Version |
|------|---------|
| ---- | ------- |
| <a name="provider_github"></a> [github](#provider\_github) | ~> 6.0 |
| <a name="provider_sops"></a> [sops](#provider\_sops) | n/a |

Expand All @@ -20,7 +20,7 @@ No modules.
## Resources

| Name | Type |
|------|------|
| ---- | ---- |
| [github_actions_secret.secrets](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_secret) | resource |
| [github_branch_protection.protections](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection) | resource |
| [github_membership.admin](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/membership) | resource |
Expand All @@ -33,7 +33,7 @@ No modules.
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| ---- | ----------- | ---- | ------- | :------: |
| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | The GitHub owner (user or organization) for the repository. | `string` | `"makeitworkcloud"` | no |
| <a name="input_github_visibility"></a> [github\_visibility](#input\_github\_visibility) | Public, private, or internal visibility | `string` | `"public"` | no |

Expand Down
2 changes: 1 addition & 1 deletion gh-protections.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
*/

resource "github_branch_protection" "protections" {
for_each = local.github_repositories
for_each = toset([for repo in local.github_repositories : repo if !contains(local.archived_github_repositories, repo)])
repository_id = github_repository.repositories[each.key].node_id
pattern = "main"
enforce_admins = false
Expand Down
1 change: 1 addition & 0 deletions gh-repositories.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
resource "github_repository" "repositories" {
for_each = local.github_repositories
name = each.key
archived = contains(local.archived_github_repositories, each.key)
visibility = var.github_visibility
allow_squash_merge = true
allow_merge_commit = true
Expand Down
25 changes: 5 additions & 20 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ locals {
"tfroot-libvirt",
"www"
])
archived_github_repositories = toset([
"ansible-project-libvirt",
"ansible-site-cluster",
"ansible-role-crc"
])
secrets = {
"onion_s3_bucket" = {
name = "ONION_AWS_S3_BUCKET"
Expand Down Expand Up @@ -74,7 +79,6 @@ locals {
name = "CLOUDFLARE_AUTH_CLIENT_ID"
value = data.sops_file.secret_vars.data["cloudflare_auth_client_id"]
repositories = [
"ansible-site-cluster",
"images",
"kustomize-cluster",
"tfroot-github"
Expand All @@ -84,7 +88,6 @@ locals {
name = "CLOUDFLARE_AUTH_CLIENT_SECRET"
value = data.sops_file.secret_vars.data["cloudflare_auth_client_secret"]
repositories = [
"ansible-site-cluster",
"images",
"kustomize-cluster",
"tfroot-github"
Expand Down Expand Up @@ -113,8 +116,6 @@ locals {
name = "SOPS_AGE_KEY"
value = data.sops_file.secret_vars.data["sops_age_key"]
repositories = [
"ansible-project-libvirt",
"ansible-site-cluster",
"tfroot-aws",
"tfroot-cloudflare",
"tfroot-github",
Expand All @@ -125,31 +126,15 @@ locals {
name = "SSH_PRIVATE_KEY"
value = data.sops_file.secret_vars.data["ssh_private_key"]
repositories = [
"ansible-site-cluster",
"tfroot-libvirt"
]
}
"ssh_known_hosts" = {
name = "SSH_KNOWN_HOSTS"
value = data.sops_file.secret_vars.data["ssh_known_hosts"]
repositories = [
"ansible-site-cluster",
"tfroot-libvirt"
]
}
"ssh_user" = {
name = "SSH_USER"
value = data.sops_file.secret_vars.data["ssh_user"]
repositories = [
"ansible-site-cluster"
]
}
"ssh_host" = {
name = "SSH_HOST"
value = data.sops_file.secret_vars.data["ssh_host"]
repositories = [
"ansible-site-cluster"
]
}
}
}
Loading
Loading