Initial Implementation of Github Repo Env Secrets
This commit is contained in:
23
.terraform.lock.hcl
generated
23
.terraform.lock.hcl
generated
@@ -88,3 +88,26 @@ provider "registry.terraform.io/hideyoshinakazone/yoshik3s" {
|
|||||||
"zh:f61160d21e55264065a0c4c818344c6afd1b5dca2a89b1b65b6767023805045a",
|
"zh:f61160d21e55264065a0c4c818344c6afd1b5dca2a89b1b65b6767023805045a",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "registry.terraform.io/integrations/github" {
|
||||||
|
version = "6.3.1"
|
||||||
|
constraints = "6.3.1"
|
||||||
|
hashes = [
|
||||||
|
"h1:kNCbU7jr9j09hqWwyXGFDN95Un28gWO2kY2yImv1MDY=",
|
||||||
|
"zh:25ae1cb97ec528e6b7e9330489f4a33acc0fa80b909c113a8445656bc524c5b9",
|
||||||
|
"zh:3e1f6300dc10e52a54f13352770ed79f25ff4ba9ac49b776c52a655a3488a20b",
|
||||||
|
"zh:4aaf2877ec22e63358d7c9cd48c7d7947d1a1dc4d03231f0af193d8975d5918a",
|
||||||
|
"zh:4b904a81fac12a2a7606c8d811cb9c4e13581adcaaa19e503a067ac95c515925",
|
||||||
|
"zh:54fe7e0dca04e698631a5b86bdd43ef09a31375e68f8f89970b4315cd5fc6312",
|
||||||
|
"zh:6b14f92cf62784eaf20f43ef58ce966735f30d43deeab077943bd410c0d8b8b2",
|
||||||
|
"zh:86c49a1c11c024b26b6750c446f104922a3fe8464d3706a5fb9a4a05c6ca0b0a",
|
||||||
|
"zh:8939fb6332c4a58c4e90245eb9f0110987ccafff06b45a7ed513f2759a2abe6a",
|
||||||
|
"zh:8b4068a78c1f357325d1151facdb1aff506b9cd79d2bab21a55651255a130e2f",
|
||||||
|
"zh:ae22f5e52f534f19811d7f9480b4eb442f12ff16367b3893abb4e449b029ff6b",
|
||||||
|
"zh:afae9cfd9d49002ddfea552aa4844074b9974bd56ff2c2458f2297fe0df56a5b",
|
||||||
|
"zh:bc7a434408eb16a4fbceec0bd86b108a491408b727071402ad572cdb1afa2eb7",
|
||||||
|
"zh:c8e4728ea2d2c6e3d2c1bc5e7d92ed1121c02bab687702ec2748e3a6a0844150",
|
||||||
|
"zh:f6314b2cff0c0a07a216501cda51b35e6a4c66a2418c7c9966ccfe701e01b6b0",
|
||||||
|
"zh:fbd1fee2c9df3aa19cf8851ce134dea6e45ea01cb85695c1726670c285797e25",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
23
config.tf
23
config.tf
@@ -15,6 +15,7 @@ variable "project_domain" {
|
|||||||
|
|
||||||
variable "k3s_token" {
|
variable "k3s_token" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "number_of_workers" {
|
variable "number_of_workers" {
|
||||||
@@ -25,14 +26,17 @@ variable "number_of_workers" {
|
|||||||
variable "aws_region" {
|
variable "aws_region" {
|
||||||
type = string
|
type = string
|
||||||
default = "sa-east-1"
|
default = "sa-east-1"
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_access" {
|
variable "aws_access" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_secret" {
|
variable "aws_secret" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_instance_type" {
|
variable "aws_instance_type" {
|
||||||
@@ -47,16 +51,35 @@ variable "aws_ami" {
|
|||||||
|
|
||||||
variable "cloudflare_api_token" {
|
variable "cloudflare_api_token" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cloudflare_zone_id" {
|
variable "cloudflare_zone_id" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ssh_public_key_main" {
|
variable "ssh_public_key_main" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ssh_public_key_ci_cd" {
|
variable "ssh_public_key_ci_cd" {
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "github_owner" {
|
||||||
|
type = string
|
||||||
|
default = "HideyoshiSolutions"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "github_token" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "github_repository" {
|
||||||
|
type = string
|
||||||
|
default = "infra-hideyoshi.com"
|
||||||
}
|
}
|
||||||
19
github/config.tf
Normal file
19
github/config.tf
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
variable "environment_name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "github_owner" {
|
||||||
|
type = string
|
||||||
|
default = "HideyoshiSolutions"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "github_repository" {
|
||||||
|
type = string
|
||||||
|
default = "infra-hideyoshi.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
variable "cluster_kubeconfig" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
23
github/github.tf
Normal file
23
github/github.tf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
github = {
|
||||||
|
source = "integrations/github"
|
||||||
|
version = "6.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data "github_user" "current" {
|
||||||
|
username = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
data "github_repository" "infra_hideyoshi_com" {
|
||||||
|
full_name = "${var.github_owner}/${var.github_repository}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "github_actions_environment_secret" "cluster_kubeconfig" {
|
||||||
|
repository = data.github_repository.infra_hideyoshi_com.name
|
||||||
|
environment = var.environment_name
|
||||||
|
secret_name = "KUBECONFIG"
|
||||||
|
plaintext_value = var.cluster_kubeconfig
|
||||||
|
}
|
||||||
@@ -29,7 +29,6 @@ resource "yoshik3s_master_node" "master_node" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node_options = [
|
node_options = [
|
||||||
"--write-kubeconfig-mode 644",
|
|
||||||
"--disable traefik",
|
"--disable traefik",
|
||||||
"--node-label node_type=master",
|
"--node-label node_type=master",
|
||||||
]
|
]
|
||||||
|
|||||||
20
main.tf
20
main.tf
@@ -14,6 +14,10 @@ terraform {
|
|||||||
source = "HideyoshiNakazone/yoshik3s"
|
source = "HideyoshiNakazone/yoshik3s"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
}
|
}
|
||||||
|
github = {
|
||||||
|
source = "integrations/github"
|
||||||
|
version = "6.3.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +35,11 @@ provider "yoshik3s" {
|
|||||||
# No configuration needed
|
# No configuration needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "github" {
|
||||||
|
owner = var.github_owner
|
||||||
|
token = var.github_token
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### MODULES
|
### MODULES
|
||||||
|
|
||||||
@@ -80,3 +89,14 @@ module "kubernetes" {
|
|||||||
cluster_main_node = module.instances.pool_master_instance
|
cluster_main_node = module.instances.pool_master_instance
|
||||||
cluster_worker_node = module.instances.pool_worker_instances
|
cluster_worker_node = module.instances.pool_worker_instances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "github" {
|
||||||
|
source = "./github"
|
||||||
|
providers = {
|
||||||
|
github = github
|
||||||
|
}
|
||||||
|
environment_name = var.environment_name
|
||||||
|
github_owner = var.github_owner
|
||||||
|
github_repository = var.github_repository
|
||||||
|
cluster_kubeconfig = module.kubernetes.cluster_kubeconfig
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user