variable update
This commit is contained in:
@@ -25,6 +25,7 @@ jobs:
|
|||||||
AWS_ACCESS_KEY_ID: https://api.staging.example.com
|
AWS_ACCESS_KEY_ID: https://api.staging.example.com
|
||||||
AWS_SECRET_ACCESS_KEY: true
|
AWS_SECRET_ACCESS_KEY: true
|
||||||
AWS_REGION: garage
|
AWS_REGION: garage
|
||||||
|
TF_VAR_vm_ssh_userkey: ${{ secrets.VM_USER_SSHKEY }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
82
.gitea/workflows/test_deploy.yml
Normal file
82
.gitea/workflows/test_deploy.yml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
name: Terraform Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
instance_mode:
|
||||||
|
description: "Instance mode"
|
||||||
|
required: true
|
||||||
|
default: "single"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- single
|
||||||
|
- multi
|
||||||
|
|
||||||
|
service_name:
|
||||||
|
description: "Service name (e.g. n8n)"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
vm_name:
|
||||||
|
description: "VM name (e.g. n8n-01)"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
node_name:
|
||||||
|
description: "Proxmox node (e.g. pop)"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
app_port:
|
||||||
|
description: "App port (e.g. 5678)"
|
||||||
|
required: false
|
||||||
|
default: "5678"
|
||||||
|
|
||||||
|
vm_tags:
|
||||||
|
description: "VM tags, comma-separated (e.g. agentic,prod)"
|
||||||
|
required: false
|
||||||
|
default: "agentic"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
terraform:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build tfvars
|
||||||
|
env:
|
||||||
|
VM_USER_SSHKEY: ${{ secrets.VM_USER_SSHKEY }}
|
||||||
|
APP_PORT: ${{ github.event.inputs.app_port }}
|
||||||
|
VM_TAGS: ${{ github.event.inputs.vm_tags }}
|
||||||
|
run: |
|
||||||
|
# Convert comma-separated tags to HCL list
|
||||||
|
TAGS_HCL=$(echo "$VM_TAGS" | tr ',' '\n' | sed 's/^/"/;s/$/"/' | paste -sd ',' | sed 's/^/[/;s/$/]/')
|
||||||
|
|
||||||
|
cat > ci.tfvars <<EOF
|
||||||
|
instance_mode = "${{ github.event.inputs.instance_mode }}"
|
||||||
|
|
||||||
|
instance = {
|
||||||
|
service_name = "${{ github.event.inputs.service_name }}"
|
||||||
|
vm_name = "${{ github.event.inputs.vm_name }}"
|
||||||
|
node_name = "${{ github.event.inputs.node_name }}"
|
||||||
|
app_port = ${APP_PORT}
|
||||||
|
vm_tags = ${TAGS_HCL}
|
||||||
|
}
|
||||||
|
|
||||||
|
vm_defaults = {
|
||||||
|
vm_user_sshkey = "${VM_USER_SSHKEY}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Setup Terraform
|
||||||
|
uses: hashicorp/setup-terraform@v3
|
||||||
|
|
||||||
|
- name: Terraform Init
|
||||||
|
run: terraform init
|
||||||
|
|
||||||
|
- name: Terraform Plan
|
||||||
|
run: terraform plan -var-file="ci.tfvars"
|
||||||
|
|
||||||
|
- name: Terraform Apply
|
||||||
|
run: terraform apply -var-file="ci.tfvars" -auto-approve
|
||||||
Reference in New Issue
Block a user