Skip to content

Commit

Permalink
fix: handle github token
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Dupain committed Nov 10, 2024
1 parent b28067f commit 869dcb7
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Create terraform.tfvars
run: |
cp github-actions.tfvars.template terraform.tfvars
envsubst '$TF_VAR_GITHUB_PAT' < github-actions.tfvars.template > terraform.tfvars
- name: Terraform Validate
run: terraform validate
Expand Down
139 changes: 139 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions examples/5-vars-from-envrc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ module "talos_k8s_cluster" {
# using env variables
}

gitops = {
repository = "https://github.com/vdupain/gitops.git"
token = var.github_pat
cluster_name = "vars-from-envrc-cluster"
}

}
3 changes: 3 additions & 0 deletions examples/5-vars-from-envrc/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
variable "github_pat" {
type = string
}
18 changes: 7 additions & 11 deletions github-actions.tfvars.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cluster = {
name = "github-actions-cluster"
name = "cicd-cluster"
network_dhcp = true
}

Expand All @@ -16,20 +16,16 @@
}

proxmox = {
# endpoint = "https://dummy:8006"
# insecure = true
# username = "username"
# password = "password"
# api_token = "terraform@pve!provider=api_token"
# using env variables
}

# certificate = {
# cert = file("../../output/my-tls.crt")
# key = file("../../output/my-tls.key")
# }

# gitops = {
# repository = "https://dummy"
# token = "github_pat"
# cluster_name = "github-actions-cluster"
# }
gitops = {
repository = "https://github.com/vdupain/gitops.git"
token = "$TF_VAR_GITHUB_PAT"
cluster_name = "cicd-cluster"
}

0 comments on commit 869dcb7

Please sign in to comment.