Skip to content
Snippets Groups Projects
Verified Commit 58a0fa25 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Update terraform template and container password

parent dd28e907
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
BASEDIR=$(dirname "$0")
if ! [ -f "$BASEDIR/secret/login.sh" ]; then
echo "Please create the login.sh file!"
exit 0
fi
source $BASEDIR/secret/login.sh
if [ -d "$BASEDIR/.terraform" ]; then
echo ".terraform folder exists."
else
terraform init \
-backend-config="address=https://git.sch.bme.hu/api/v4/projects/${GITLAB_PROJECT_ID}/terraform/state/${GITLAB_STATE_NAME}" \
-backend-config="lock_address=https://git.sch.bme.hu/api/v4/projects/${GITLAB_PROJECT_ID}/terraform/state/${GITLAB_STATE_NAME}/lock" \
-backend-config="unlock_address=https://git.sch.bme.hu/api/v4/projects/${GITLAB_PROJECT_ID}/terraform/state/${GITLAB_STATE_NAME}/lock" \
-backend-config="username=${GITLAB_USER}" \
-backend-config="password=${GITLAB_REPO_TOKEN}" \
-backend-config="lock_method=POST" \
-backend-config="unlock_method=DELETE" \
-backend-config="retry_wait_min=5" \
-reconfigure
fi
echo "Environment has been set up."
# to stay in our comfy virtualenv
exec "${SHELL:bash}"
\ No newline at end of file
...@@ -19,3 +19,7 @@ locals { ...@@ -19,3 +19,7 @@ locals {
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHXuXr/Mz1ENkvZ+Ntc9dF1r8VK62XaZtsMaV7N+CMZ8 rlacko ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHXuXr/Mz1ENkvZ+Ntc9dF1r8VK62XaZtsMaV7N+CMZ8 rlacko
EOF EOF
} }
variable "ct_passwords" {
type = string
}
#!/bin/bash
source secret/login.sh
PROJ_ID="3419"
STATE_NAME="maze"
terraform init \
-backend-config="address=https://git.sch.bme.hu/api/v4/projects/${PROJ_ID}/terraform/state/${STATE_NAME}" \
-backend-config="lock_address=https://git.sch.bme.hu/api/v4/projects/${PROJ_ID}/terraform/state/${STATE_NAME}/lock" \
-backend-config="unlock_address=https://git.sch.bme.hu/api/v4/projects/${PROJ_ID}/terraform/state/${STATE_NAME}/lock" \
-backend-config="username=${GITLAB_USER}" \
-backend-config="password=${GITLAB_REPO_PAT}" \
-backend-config="lock_method=POST" \
-backend-config="unlock_method=DELETE" \
-backend-config="retry_wait_min=5" \
-reconfigure
variable "router_password" {
type = string
}
resource "proxmox_lxc" "router" { resource "proxmox_lxc" "router" {
target_node = "maze" target_node = "maze"
hostname = "router" hostname = "router"
ostemplate = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz" ostemplate = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
password = var.router_password password = var.ct_passwords
vmid = 9254 vmid = 9254
start = true start = true
memory = 4096 memory = 4096
...@@ -18,7 +14,7 @@ resource "proxmox_lxc" "router" { ...@@ -18,7 +14,7 @@ resource "proxmox_lxc" "router" {
ssh_public_keys = local.ssh_keys ssh_public_keys = local.ssh_keys
rootfs { rootfs {
storage = "ssd" storage = "z-one"
size = "8G" size = "8G"
} }
......
...@@ -17,9 +17,9 @@ resource "proxmox_vm_qemu" "gitlab-runner" { ...@@ -17,9 +17,9 @@ resource "proxmox_vm_qemu" "gitlab-runner" {
os_type = "cloud-init" os_type = "cloud-init"
disk { disk {
size = "35G" size = "40G"
type = "virtio" type = "virtio"
storage = "ssd" storage = "z-one"
} }
network { network {
......
export GITLAB_USER="" #!/bin/bash
export GITLAB_REPO_PAT=""
export PM_USER="" # Gitlab Project ID, this will be used as state store
export PM_PASS="" export GITLAB_PROJECT_ID="0"
\ No newline at end of file # If you want to rename the terraform state name, feel free.
export GITLAB_STATE_NAME="state"
# GitLab username
export GITLAB_USER="user"
# Access token with API Acces to the repo
export GITLAB_REPO_TOKEN="acces token"
# vSphere Username
export TF_VAR_vsphere_user="username"
# vSphere Password
export TF_VAR_vsphere_password="pw"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment