mirror of
https://github.com/khuedoan/homelab.git
synced 2024-12-23 01:04:32 +07:00
refactor(external): ask to enter variables if var file does not exist
This commit is contained in:
parent
c55b98186d
commit
08513dcda5
@ -1,11 +1,17 @@
|
|||||||
.POSIX:
|
.POSIX:
|
||||||
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
|
||||||
|
KUBE_CONFIG_PATH = ../metal/kubeconfig.yaml
|
||||||
|
|
||||||
default: apply
|
default: apply
|
||||||
|
|
||||||
~/.terraform.d/credentials.tfrc.json:
|
~/.terraform.d/credentials.tfrc.json:
|
||||||
terraform login
|
terraform login
|
||||||
|
|
||||||
.terraform.lock.hcl: ~/.terraform.d/credentials.tfrc.json versions.tf
|
terraform.tfvars:
|
||||||
|
ansible-playbook secrets.yml
|
||||||
|
|
||||||
|
.terraform.lock.hcl: ~/.terraform.d/credentials.tfrc.json versions.tf terraform.tfvars
|
||||||
terraform init
|
terraform init
|
||||||
touch .terraform.lock.hcl
|
touch .terraform.lock.hcl
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
variable "cloudflare_account_id" {
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
data "cloudflare_zone" "khuedoan_com" {
|
data "cloudflare_zone" "khuedoan_com" {
|
||||||
name = "khuedoan.com"
|
name = "khuedoan.com"
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
vars_prompt:
|
vars_prompt:
|
||||||
- name: cloudflare_email
|
- name: cloudflare_email
|
||||||
prompt: Enter Cloudflare email
|
prompt: Enter Cloudflare email
|
||||||
|
private: no
|
||||||
- name: cloudflare_api_key
|
- name: cloudflare_api_key
|
||||||
prompt: Enter Cloudflare API Key
|
prompt: Enter Cloudflare API Key (sensitive)
|
||||||
- name: cloudflare_account_id
|
- name: cloudflare_account_id
|
||||||
prompt: Enter Cloudflare account ID
|
prompt: Enter Cloudflare account ID
|
||||||
|
private: no
|
||||||
- name: b2_application_key_id
|
- name: b2_application_key_id
|
||||||
prompt: Enter Backblaze application key ID
|
prompt: Enter Backblaze application key ID
|
||||||
|
private: no
|
||||||
- name: b2_application_key
|
- name: b2_application_key
|
||||||
prompt: Enter Backblaze application key
|
prompt: Enter Backblaze application key (sensitive)
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure required namespaces exist
|
- name: Ensure required namespaces exist
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
@ -24,3 +27,7 @@
|
|||||||
- cert-manager
|
- cert-manager
|
||||||
- external-dns
|
- external-dns
|
||||||
- cloudflared
|
- cloudflared
|
||||||
|
- name: Render environment file
|
||||||
|
template:
|
||||||
|
src: ./terraform.tfvars.j2
|
||||||
|
dest: ./terraform.tfvars
|
||||||
|
5
external/terraform.tfvars.j2
Normal file
5
external/terraform.tfvars.j2
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cloudflare_email = "{{ cloudflare_email }}"
|
||||||
|
cloudflare_api_key = "{{ cloudflare_api_key }}"
|
||||||
|
cloudflare_account_id = "{{ cloudflare_account_id }}"
|
||||||
|
b2_application_key_id = "{{ b2_application_key_id }}"
|
||||||
|
b2_application_key = "{{ b2_application_key }}"
|
21
external/variables.tf
Normal file
21
external/variables.tf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
variable "cloudflare_email" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "cloudflare_api_key" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "cloudflare_account_id" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "b2_application_key_id" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "b2_application_key" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
@ -34,17 +34,16 @@ terraform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provider "cloudflare" {
|
provider "cloudflare" {
|
||||||
# Environment variables
|
email = var.cloudflare_email
|
||||||
# CLOUDFLARE_API_TOKEN
|
api_key = var.cloudflare_api_key
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "b2" {
|
provider "b2" {
|
||||||
# Environment variables
|
application_key_id = var.b2_application_key_id
|
||||||
# B2_APPLICATION_KEY
|
application_key = var.b2_application_key
|
||||||
# B2_APPLICATION_KEY_ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "kubernetes" {
|
provider "kubernetes" {
|
||||||
# Environment variables
|
# Use KUBE_CONFIG_PATH environment variables
|
||||||
# KUBE_CONFIG_PATH
|
# Or in cluster service account
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user