File tree Expand file tree Collapse file tree 6 files changed +62
-2
lines changed Expand file tree Collapse file tree 6 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,16 @@ No modules.
71
71
72
72
| Name | Type |
73
73
| ------| ------|
74
- | [ github_repository.repo] ( https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/repository ) | data source |
74
+ | [ github_actions_secret.this] ( https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_secret ) | resource |
75
+ | [ github_repository.this] ( https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/repository ) | data source |
75
76
76
77
## Inputs
77
78
78
79
| Name | Description | Type | Default | Required |
79
80
| ------| -------------| ------| ---------| :--------:|
81
+ | <a name =" input_environment_secrets " ></a > [ environment\_ secrets] ( #input\_ environment\_ secrets ) | A map of environment-scoped secrets | ` map(any) ` | ` {} ` | no |
80
82
| <a name =" input_repository " ></a > [ repository] ( #input\_ repository ) | The full name of the repository in the form org/repo | ` string ` | n/a | yes |
83
+ | <a name =" input_secrets " ></a > [ secrets] ( #input\_ secrets ) | A map of secret definitions | ` map(any) ` | ` {} ` | no |
81
84
82
85
## Outputs
83
86
Original file line number Diff line number Diff line change 1
- data "github_repository" "repo " {
1
+ data "github_repository" "this " {
2
2
full_name = var. repository
3
3
}
Original file line number Diff line number Diff line change
1
+ module "env" {
2
+ source = " tbobm/environments/github"
3
+ version = " 1.0.0"
4
+
5
+ repository = " tbobm/terraform-github-secrets"
6
+
7
+ environments = {
8
+ " staging" = {}
9
+ " production" = {}
10
+ }
11
+ }
12
+
13
+ module "secrets" {
14
+ source = " ../"
15
+
16
+ repository = " tbobm/terraform-github-secrets"
17
+
18
+ secrets = {
19
+ deploy_key = {
20
+ name = " DEPLOY_KEY"
21
+ plaintext = " ABCDEF"
22
+ }
23
+ registry_username = {
24
+ name = " DOCKERHUB_USERNAME"
25
+ plaintext = " sampleuser"
26
+ }
27
+ registry_password = {
28
+ name = " DOCKERHUB_PASSWORD"
29
+ plaintext = " samplepass"
30
+ }
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ locals {
2
+ secrets = {
3
+ for key , value in var . secrets :
4
+ key = > value
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ resource "github_actions_secret" "this" {
2
+ for_each = local. secrets
3
+
4
+ repository = data. github_repository . this . name
5
+ secret_name = each. value . name
6
+ plaintext_value = each. value . plaintext
7
+ }
Original file line number Diff line number Diff line change @@ -2,3 +2,15 @@ variable "repository" {
2
2
type = string
3
3
description = " The full name of the repository in the form org/repo"
4
4
}
5
+
6
+ variable "secrets" {
7
+ type = map (any )
8
+ description = " A map of secret definitions"
9
+ default = {}
10
+ }
11
+
12
+ variable "environment_secrets" {
13
+ type = map (any )
14
+ description = " A map of environment-scoped secrets"
15
+ default = {}
16
+ }
You can’t perform that action at this time.
0 commit comments