REMOVE: 删除不再使用的 Terraform 配置文件
Some checks failed
Deploy Nomad Configurations / deploy-nomad (push) Failing after 7m45s
Infrastructure CI/CD / Validate Infrastructure (push) Failing after 2m33s
Infrastructure CI/CD / Plan Infrastructure (push) Has been skipped
Infrastructure CI/CD / Apply Infrastructure (push) Has been skipped
Simple Test / test (push) Failing after 2m48s
Some checks failed
Deploy Nomad Configurations / deploy-nomad (push) Failing after 7m45s
Infrastructure CI/CD / Validate Infrastructure (push) Failing after 2m33s
Infrastructure CI/CD / Plan Infrastructure (push) Has been skipped
Infrastructure CI/CD / Apply Infrastructure (push) Has been skipped
Simple Test / test (push) Failing after 2m48s
- 移除 nomad-terraform.tf 和 test_opentofu_consul.tf 文件 - 更新 Ansible inventory,注释掉不存在的节点 hcp2 - 修改 inventory.ini,确保节点配置的准确性 - 在 nomad-config 模块中添加 null_provider 以支持新配置 - 更新 influxdb1.hcl,添加 Grafana 和 Prometheus 数据卷配置
This commit is contained in:
109
check-oci-instances/check-ash2e-instance.tf
Normal file
109
check-oci-instances/check-ash2e-instance.tf
Normal file
@@ -0,0 +1,109 @@
|
||||
# 检查 ash2e 实例状态
|
||||
terraform {
|
||||
required_providers {
|
||||
oci = {
|
||||
source = "oracle/oci"
|
||||
version = "~> 7.0"
|
||||
}
|
||||
consul = {
|
||||
source = "hashicorp/consul"
|
||||
version = "~> 2.22"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 从 Consul 获取美国区域配置
|
||||
data "consul_keys" "oracle_config_us_check" {
|
||||
key {
|
||||
name = "tenancy_ocid"
|
||||
path = "config/dev/oracle/us/tenancy_ocid"
|
||||
}
|
||||
key {
|
||||
name = "user_ocid"
|
||||
path = "config/dev/oracle/us/user_ocid"
|
||||
}
|
||||
key {
|
||||
name = "fingerprint"
|
||||
path = "config/dev/oracle/us/fingerprint"
|
||||
}
|
||||
key {
|
||||
name = "private_key_path"
|
||||
path = "config/dev/oracle/us/private_key_path"
|
||||
}
|
||||
key {
|
||||
name = "region"
|
||||
path = "config/dev/oracle/us/region"
|
||||
}
|
||||
}
|
||||
|
||||
# 配置美国区域 Provider
|
||||
provider "oci" {
|
||||
alias = "us_check"
|
||||
tenancy_ocid = data.consul_keys.oracle_config_us_check.var.tenancy_ocid
|
||||
user_ocid = data.consul_keys.oracle_config_us_check.var.user_ocid
|
||||
fingerprint = data.consul_keys.oracle_config_us_check.var.fingerprint
|
||||
private_key_path = data.consul_keys.oracle_config_us_check.var.private_key_path
|
||||
region = data.consul_keys.oracle_config_us_check.var.region
|
||||
}
|
||||
|
||||
# 获取美国区域的所有实例
|
||||
data "oci_core_instances" "us_instances" {
|
||||
provider = oci.us_check
|
||||
compartment_id = data.consul_keys.oracle_config_us_check.var.tenancy_ocid
|
||||
}
|
||||
|
||||
# 获取美国区域的所有磁盘卷
|
||||
data "oci_core_volumes" "us_volumes" {
|
||||
provider = oci.us_check
|
||||
compartment_id = data.consul_keys.oracle_config_us_check.var.tenancy_ocid
|
||||
}
|
||||
|
||||
# 获取美国区域的所有启动卷
|
||||
data "oci_core_boot_volumes" "us_boot_volumes" {
|
||||
provider = oci.us_check
|
||||
availability_domain = "TZXJ:US-ASHBURN-AD-1"
|
||||
compartment_id = data.consul_keys.oracle_config_us_check.var.tenancy_ocid
|
||||
}
|
||||
|
||||
# 输出所有实例信息
|
||||
output "us_instances_status" {
|
||||
value = {
|
||||
for instance in data.oci_core_instances.us_instances.instances :
|
||||
instance.display_name => {
|
||||
id = instance.id
|
||||
state = instance.state
|
||||
shape = instance.shape
|
||||
availability_domain = instance.availability_domain
|
||||
time_created = instance.time_created
|
||||
}
|
||||
}
|
||||
description = "美国区域所有实例状态"
|
||||
}
|
||||
|
||||
# 输出磁盘状态 - 关键信息!
|
||||
output "us_volumes_status" {
|
||||
value = {
|
||||
for volume in data.oci_core_volumes.us_volumes.volumes :
|
||||
volume.display_name => {
|
||||
id = volume.id
|
||||
state = volume.state
|
||||
size_in_gbs = volume.size_in_gbs
|
||||
time_created = volume.time_created
|
||||
}
|
||||
}
|
||||
description = "美国区域所有数据磁盘状态"
|
||||
}
|
||||
|
||||
# 输出启动磁盘状态 - 更关键!
|
||||
output "us_boot_volumes_status" {
|
||||
value = {
|
||||
for boot_volume in data.oci_core_boot_volumes.us_boot_volumes.boot_volumes :
|
||||
boot_volume.display_name => {
|
||||
id = boot_volume.id
|
||||
state = boot_volume.state
|
||||
size_in_gbs = boot_volume.size_in_gbs
|
||||
time_created = boot_volume.time_created
|
||||
}
|
||||
}
|
||||
description = "美国区域所有启动磁盘状态 - ash2e 的配置可能还在这里!"
|
||||
}
|
||||
Reference in New Issue
Block a user