fix: update Terraform workflow to download and upload state files
Some checks failed
Terraform CI/CD / terraform (push) Has been cancelled
Some checks failed
Terraform CI/CD / terraform (push) Has been cancelled
This commit is contained in:
17
.github/workflows/terraform.yaml
vendored
17
.github/workflows/terraform.yaml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
terraform:
|
||||
runs-on: ssot
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: hashicorp/terraform:1.6.6
|
||||
@@ -23,6 +23,14 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Download previous Terraform state if it exists
|
||||
- name: Download previous Terraform state
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: terraform-state
|
||||
path: terraform/
|
||||
continue-on-error: true # skip if no previous state exists
|
||||
|
||||
- name: Terraform Init
|
||||
run: terraform -chdir=terraform init -input=false
|
||||
|
||||
@@ -46,3 +54,10 @@ jobs:
|
||||
- name: Terraform Apply
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: terraform -chdir=terraform apply -input=false -auto-approve tfplan
|
||||
|
||||
# Upload updated Terraform state
|
||||
- name: Upload Terraform state
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: terraform-state
|
||||
path: terraform/terraform.tfstate
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
{
|
||||
"version": 4,
|
||||
"terraform_version": "1.14.3",
|
||||
"serial": 16,
|
||||
"lineage": "2f42bf18-041f-78d9-24cc-d9a193bc3daf",
|
||||
"outputs": {},
|
||||
"resources": [
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "hcloud_firewall",
|
||||
"name": "production_fw",
|
||||
"provider": "provider[\"registry.terraform.io/hetznercloud/hcloud\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"apply_to": [],
|
||||
"id": "10323541",
|
||||
"labels": {},
|
||||
"name": "production-fw",
|
||||
"rule": [
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
],
|
||||
"direction": "out",
|
||||
"port": "any",
|
||||
"protocol": "tcp",
|
||||
"source_ips": []
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
],
|
||||
"direction": "out",
|
||||
"port": "any",
|
||||
"protocol": "udp",
|
||||
"source_ips": []
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "22",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "443",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "80",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "hcloud_network",
|
||||
"name": "prodnet",
|
||||
"provider": "provider[\"registry.terraform.io/hetznercloud/hcloud\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"delete_protection": false,
|
||||
"expose_routes_to_vswitch": false,
|
||||
"id": "11773043",
|
||||
"ip_range": "10.0.0.0/16",
|
||||
"labels": {},
|
||||
"name": "prod-network"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster",
|
||||
"name": "hetzner_cluster",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"cluster_group_id": 1,
|
||||
"cluster_type_id": 1,
|
||||
"comments": "",
|
||||
"description": "",
|
||||
"id": "1",
|
||||
"location_id": 0,
|
||||
"name": "Hetzner Cluster",
|
||||
"region_id": 0,
|
||||
"site_group_id": 0,
|
||||
"site_id": 0,
|
||||
"tags": [],
|
||||
"tags_all": [],
|
||||
"tenant_id": 0
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA==",
|
||||
"dependencies": [
|
||||
"netbox_cluster_group.hetzner",
|
||||
"netbox_cluster_type.openstack"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster_group",
|
||||
"name": "hetzner",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"description": "Hetzner Cloud Hosts",
|
||||
"id": "1",
|
||||
"name": "hetzner",
|
||||
"slug": "hetzner"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster_type",
|
||||
"name": "openstack",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"id": "1",
|
||||
"name": "Openstack",
|
||||
"slug": "openstack"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_ip_range",
|
||||
"name": "prodnet",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"description": null,
|
||||
"end_address": "10.0.255.254/16",
|
||||
"id": "1",
|
||||
"role_id": null,
|
||||
"size": 65534,
|
||||
"start_address": "10.0.0.1/16",
|
||||
"status": "active",
|
||||
"tags": [],
|
||||
"tags_all": [],
|
||||
"tenant_id": null,
|
||||
"vrf_id": null
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"check_results": null
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
{
|
||||
"version": 4,
|
||||
"terraform_version": "1.14.3",
|
||||
"serial": 14,
|
||||
"lineage": "2f42bf18-041f-78d9-24cc-d9a193bc3daf",
|
||||
"outputs": {},
|
||||
"resources": [
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "hcloud_firewall",
|
||||
"name": "production_fw",
|
||||
"provider": "provider[\"registry.terraform.io/hetznercloud/hcloud\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"apply_to": [],
|
||||
"id": "10323541",
|
||||
"labels": {},
|
||||
"name": "production-fw",
|
||||
"rule": [
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
],
|
||||
"direction": "out",
|
||||
"port": "any",
|
||||
"protocol": "tcp",
|
||||
"source_ips": []
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
],
|
||||
"direction": "out",
|
||||
"port": "any",
|
||||
"protocol": "udp",
|
||||
"source_ips": []
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "22",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "443",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"destination_ips": [],
|
||||
"direction": "in",
|
||||
"port": "80",
|
||||
"protocol": "tcp",
|
||||
"source_ips": [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "hcloud_network",
|
||||
"name": "prodnet",
|
||||
"provider": "provider[\"registry.terraform.io/hetznercloud/hcloud\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"delete_protection": false,
|
||||
"expose_routes_to_vswitch": false,
|
||||
"id": "11773043",
|
||||
"ip_range": "10.0.0.0/16",
|
||||
"labels": {},
|
||||
"name": "prod-network"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster",
|
||||
"name": "hetzner_cluster",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"cluster_group_id": 1,
|
||||
"cluster_type_id": 1,
|
||||
"comments": "",
|
||||
"description": "",
|
||||
"id": "1",
|
||||
"location_id": 0,
|
||||
"name": "hetzner_openstack_cluster",
|
||||
"region_id": 0,
|
||||
"site_group_id": 0,
|
||||
"site_id": 0,
|
||||
"tags": null,
|
||||
"tags_all": [],
|
||||
"tenant_id": 0
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA==",
|
||||
"dependencies": [
|
||||
"netbox_cluster_group.hetzner",
|
||||
"netbox_cluster_type.openstack"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster_group",
|
||||
"name": "hetzner",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"description": "Hetzner Cloud Hosts",
|
||||
"id": "1",
|
||||
"name": "hetzner",
|
||||
"slug": "hetzner"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_cluster_type",
|
||||
"name": "openstack",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"id": "1",
|
||||
"name": "Openstack",
|
||||
"slug": "openstack"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "netbox_ip_range",
|
||||
"name": "prodnet",
|
||||
"provider": "provider[\"registry.terraform.io/e-breuninger/netbox\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"description": null,
|
||||
"end_address": "10.0.255.254/16",
|
||||
"id": "1",
|
||||
"role_id": null,
|
||||
"size": 65534,
|
||||
"start_address": "10.0.0.1/16",
|
||||
"status": "active",
|
||||
"tags": [],
|
||||
"tags_all": [],
|
||||
"tenant_id": null,
|
||||
"vrf_id": null
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"identity_schema_version": 0,
|
||||
"private": "bnVsbA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"check_results": null
|
||||
}
|
||||
Reference in New Issue
Block a user