@adamhl8/configs 0.33.1 → 0.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
data "sops_file" "secrets" {
|
|
2
|
+
source_file = pathexpand("~/secrets.yaml")
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
data "github_actions_secrets" "current" {
|
|
6
|
+
name = var.repo_name
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
locals {
|
|
10
|
+
desired_secrets = setunion(
|
|
11
|
+
toset([for k, v in var.actions_secrets : k if v]),
|
|
12
|
+
var.additional_secrets
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
locals {
|
|
17
|
+
unmanaged_secrets = setsubtract(
|
|
18
|
+
data.github_actions_secrets.current.secrets[*].name,
|
|
19
|
+
local.desired_secrets
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
check "no_unmanaged_secrets" {
|
|
24
|
+
assert {
|
|
25
|
+
condition = length(local.unmanaged_secrets) == 0
|
|
26
|
+
error_message = "Unmanaged secrets on '${var.repo_name}': ${join(", ", local.unmanaged_secrets)}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
resource "github_actions_secret" "secrets" {
|
|
31
|
+
for_each = local.desired_secrets
|
|
32
|
+
repository = var.repo_name
|
|
33
|
+
secret_name = each.value
|
|
34
|
+
value = data.sops_file.secrets.data[lower(each.value)]
|
|
35
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
data "local_file" "package_json" {
|
|
2
|
+
filename = "${path.root}/package.json"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
locals {
|
|
6
|
+
package_json = jsondecode(data.local_file.package_json.content)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
resource "github_repository" "current" {
|
|
10
|
+
name = var.repo_name
|
|
11
|
+
description = local.package_json.description
|
|
12
|
+
visibility = var.repo_settings.visibility
|
|
13
|
+
homepage_url = var.repo_settings.homepage_url
|
|
14
|
+
topics = try(local.package_json.keywords, [])
|
|
15
|
+
|
|
16
|
+
allow_merge_commit = false
|
|
17
|
+
allow_auto_merge = false
|
|
18
|
+
allow_forking = true
|
|
19
|
+
allow_rebase_merge = false
|
|
20
|
+
allow_squash_merge = true
|
|
21
|
+
allow_update_branch = false
|
|
22
|
+
delete_branch_on_merge = true
|
|
23
|
+
has_discussions = true
|
|
24
|
+
has_issues = true
|
|
25
|
+
has_projects = false
|
|
26
|
+
has_wiki = false
|
|
27
|
+
squash_merge_commit_title = "PR_TITLE"
|
|
28
|
+
squash_merge_commit_message = "BLANK"
|
|
29
|
+
web_commit_signoff_required = false
|
|
30
|
+
|
|
31
|
+
security_and_analysis {
|
|
32
|
+
secret_scanning {
|
|
33
|
+
status = "enabled"
|
|
34
|
+
}
|
|
35
|
+
secret_scanning_push_protection {
|
|
36
|
+
status = "enabled"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
resource "github_actions_repository_permissions" "current" {
|
|
42
|
+
repository = github_repository.current.name
|
|
43
|
+
allowed_actions = "all"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
resource "github_repository_vulnerability_alerts" "current" {
|
|
47
|
+
repository = github_repository.current.name
|
|
48
|
+
enabled = true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
resource "github_repository_dependabot_security_updates" "current" {
|
|
52
|
+
repository = github_repository.current.name
|
|
53
|
+
enabled = false
|
|
54
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
variable "repo_name" {
|
|
2
|
+
description = "The GitHub repository name"
|
|
3
|
+
type = string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
variable "repo_settings" {
|
|
7
|
+
description = "The GitHub repository settings"
|
|
8
|
+
type = object({
|
|
9
|
+
visibility = string
|
|
10
|
+
homepage_url = optional(string, null)
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
variable "actions_secrets" {
|
|
15
|
+
description = "defaults: CI_SIGNING_KEY, CI_TOKEN"
|
|
16
|
+
type = object({
|
|
17
|
+
CI_SIGNING_KEY = optional(bool, true)
|
|
18
|
+
CI_TOKEN = optional(bool, true)
|
|
19
|
+
NPM_CI_TOKEN = optional(bool, false)
|
|
20
|
+
GH_TOKEN = optional(bool, false)
|
|
21
|
+
})
|
|
22
|
+
default = {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
variable "additional_secrets" {
|
|
26
|
+
description = "Additional secret names to manage"
|
|
27
|
+
type = set(string)
|
|
28
|
+
default = []
|
|
29
|
+
}
|