mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-opentofu-private.git
synced 2025-10-26 23:33:17 +00:00
teste-0
This commit is contained in:
@ -15,4 +15,13 @@ jobs:
|
|||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
- name: Cloning iac repository
|
- name: Cloning iac repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Init OpenTofu
|
||||||
|
run: tofu init
|
||||||
|
|
||||||
|
- name: Plan
|
||||||
|
run: tofu plan -out=tfplan
|
||||||
|
|
||||||
|
- name: Apply
|
||||||
|
run: tofu apply -auto-approve tfplan
|
||||||
13
documentation/start.txt
Normal file
13
documentation/start.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
https://spacelift.io/blog/opentofu-tutorial - explaining language of opentofu
|
||||||
|
|
||||||
|
https://opentofu.org/docs/intro/ - quick start and explaning who to work in team
|
||||||
|
|
||||||
|
https://opentofu.org/docs/intro/ - CICD for opentofu explained
|
||||||
|
|
||||||
|
|
||||||
|
tofu init
|
||||||
|
tofu plan --var-file=opentofu-varfile.json
|
||||||
|
yes
|
||||||
|
|
||||||
|
tofu apply --var-file=opentofu-varfile.json
|
||||||
|
yes
|
||||||
20
main.tf
Normal file
20
main.tf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = "~> 3.6"
|
||||||
|
}
|
||||||
|
vaultwarden = {
|
||||||
|
source = "ottramst/vaultwarden"
|
||||||
|
version = "0.4.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
backend "consul" {
|
||||||
|
address = "consul-server.iac-consul.svc.cluster.local:8500" # Consul service DNS inside cluster
|
||||||
|
path = "opentofu/iac-fenix" # unique path per project
|
||||||
|
scheme = "http" # or "https" if you add TLS
|
||||||
|
lock = true # enable state locking
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "random" {}
|
||||||
2
secrets/consul.secrets.tfvars
Normal file
2
secrets/consul.secrets.tfvars
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
consul_server = "consul-server.iac-consul.svc.cluster.local:8500"
|
||||||
|
# token is read automatically from CONSUL_HTTP_TOKEN
|
||||||
4
secrets/vaultwarden.secrets.tfvars
Normal file
4
secrets/vaultwarden.secrets.tfvars
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vaultwarden_server = "https://vaultwarden.example.com"
|
||||||
|
vaultwarden_email = "admin@example.com"
|
||||||
|
vaultwarden_master_password = "SuperSecretMasterPassword"
|
||||||
|
vaultwarden_admin_token = "tokenadmin"
|
||||||
5
variables/consul.variables.tf
Normal file
5
variables/consul.variables.tf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
variable "consul_server" {
|
||||||
|
description = "consul server URL"
|
||||||
|
type = string
|
||||||
|
sensitive = false
|
||||||
|
}
|
||||||
23
variables/vaultwarden.variables.tf
Normal file
23
variables/vaultwarden.variables.tf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
variable "vaultwarden_server" {
|
||||||
|
description = "Vaultwarden server URL"
|
||||||
|
type = string
|
||||||
|
sensitive = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vaultwarden_email" {
|
||||||
|
description = "Vaultwarden login email"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vaultwarden_master_password" {
|
||||||
|
description = "Vaultwarden master password"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vaultwarden_admin_token" {
|
||||||
|
description = "Vaultwarden admin token"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
12
vaultwarden.tf
Normal file
12
vaultwarden.tf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
provider "vaultwarden" {
|
||||||
|
endpoint = var.vaultwarden_server
|
||||||
|
email = var.vaultwarden_email
|
||||||
|
master_password = var.vaultwarden_master_password
|
||||||
|
admin_token = var.vaultwarden_admin_token
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "vaultwarden_account_register" "vaultwarden-acount-fenix" {
|
||||||
|
name = "fenix"
|
||||||
|
email = var.vaultwarden_email
|
||||||
|
password = var.vaultwarden_master_password
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user