Test webhook deployment
- Add OCI credentials to Consul - Configure OpenTofu plugin cache - Test GitOps automation
This commit is contained in:
parent
cef3ab7534
commit
edae611b31
|
|
@ -16,8 +16,8 @@ data "consul_keys" "oracle_config" {
|
||||||
path = "config/dev/oracle/kr/fingerprint"
|
path = "config/dev/oracle/kr/fingerprint"
|
||||||
}
|
}
|
||||||
key {
|
key {
|
||||||
name = "private_key"
|
name = "private_key_path"
|
||||||
path = "config/dev/oracle/kr/private_key"
|
path = "config/dev/oracle/kr/private_key_path"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,8 +36,8 @@ data "consul_keys" "oracle_config_us" {
|
||||||
path = "config/dev/oracle/us/fingerprint"
|
path = "config/dev/oracle/us/fingerprint"
|
||||||
}
|
}
|
||||||
key {
|
key {
|
||||||
name = "private_key"
|
name = "private_key_path"
|
||||||
path = "config/dev/oracle/us/private_key"
|
path = "config/dev/oracle/us/private_key_path"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ provider "oci" {
|
||||||
tenancy_ocid = data.consul_keys.oracle_config.var.tenancy_ocid
|
tenancy_ocid = data.consul_keys.oracle_config.var.tenancy_ocid
|
||||||
user_ocid = data.consul_keys.oracle_config.var.user_ocid
|
user_ocid = data.consul_keys.oracle_config.var.user_ocid
|
||||||
fingerprint = data.consul_keys.oracle_config.var.fingerprint
|
fingerprint = data.consul_keys.oracle_config.var.fingerprint
|
||||||
private_key = data.consul_keys.oracle_config.var.private_key
|
private_key_path = data.consul_keys.oracle_config.var.private_key_path
|
||||||
region = "ap-chuncheon-1"
|
region = "ap-chuncheon-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +56,6 @@ provider "oci" {
|
||||||
tenancy_ocid = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
tenancy_ocid = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
||||||
user_ocid = data.consul_keys.oracle_config_us.var.user_ocid
|
user_ocid = data.consul_keys.oracle_config_us.var.user_ocid
|
||||||
fingerprint = data.consul_keys.oracle_config_us.var.fingerprint
|
fingerprint = data.consul_keys.oracle_config_us.var.fingerprint
|
||||||
private_key = data.consul_keys.oracle_config_us.var.private_key
|
private_key_path = data.consul_keys.oracle_config_us.var.private_key_path
|
||||||
region = "us-ashburn-1"
|
region = "us-ashburn-1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
# 测试从Consul获取OCI配置
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
oci = {
|
||||||
|
source = "oracle/oci"
|
||||||
|
version = "~> 7.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 从Consul获取韩国区域配置
|
||||||
|
data "consul_keys" "oracle_config_kr" {
|
||||||
|
key {
|
||||||
|
name = "tenancy_ocid"
|
||||||
|
path = "config/dev/oracle/kr/tenancy_ocid"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "user_ocid"
|
||||||
|
path = "config/dev/oracle/kr/user_ocid"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "fingerprint"
|
||||||
|
path = "config/dev/oracle/kr/fingerprint"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "private_key_path"
|
||||||
|
path = "config/dev/oracle/kr/private_key_path"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "region"
|
||||||
|
path = "config/dev/oracle/kr/region"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 从Consul获取美国区域配置
|
||||||
|
data "consul_keys" "oracle_config_us" {
|
||||||
|
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" {
|
||||||
|
tenancy_ocid = data.consul_keys.oracle_config_kr.var.tenancy_ocid
|
||||||
|
user_ocid = data.consul_keys.oracle_config_kr.var.user_ocid
|
||||||
|
fingerprint = data.consul_keys.oracle_config_kr.var.fingerprint
|
||||||
|
private_key_path = data.consul_keys.oracle_config_kr.var.private_key_path
|
||||||
|
region = data.consul_keys.oracle_config_kr.var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
# 美国区域Provider
|
||||||
|
provider "oci" {
|
||||||
|
alias = "us"
|
||||||
|
tenancy_ocid = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
||||||
|
user_ocid = data.consul_keys.oracle_config_us.var.user_ocid
|
||||||
|
fingerprint = data.consul_keys.oracle_config_us.var.fingerprint
|
||||||
|
private_key_path = data.consul_keys.oracle_config_us.var.private_key_path
|
||||||
|
region = data.consul_keys.oracle_config_us.var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
# 测试韩国区域连接
|
||||||
|
data "oci_identity_compartments" "kr_compartments" {
|
||||||
|
compartment_id = data.consul_keys.oracle_config_kr.var.tenancy_ocid
|
||||||
|
}
|
||||||
|
|
||||||
|
# 测试美国区域连接
|
||||||
|
data "oci_identity_compartments" "us_compartments" {
|
||||||
|
provider = oci.us
|
||||||
|
compartment_id = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
||||||
|
}
|
||||||
|
|
||||||
|
# 输出Consul数据
|
||||||
|
output "consul_kr_config" {
|
||||||
|
value = data.consul_keys.oracle_config_kr.var
|
||||||
|
}
|
||||||
|
|
||||||
|
output "consul_us_config" {
|
||||||
|
value = data.consul_keys.oracle_config_us.var
|
||||||
|
}
|
||||||
|
|
||||||
|
# 输出OCI数据
|
||||||
|
output "kr_compartments" {
|
||||||
|
value = data.oci_identity_compartments.kr_compartments.compartments
|
||||||
|
}
|
||||||
|
|
||||||
|
output "us_compartments" {
|
||||||
|
value = data.oci_identity_compartments.us_compartments.compartments
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
# OpenTofu配置 - 使用Terraform的插件缓存
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
oci = {
|
||||||
|
source = "oracle/oci"
|
||||||
|
version = "7.20.0" # 使用已有的版本
|
||||||
|
}
|
||||||
|
consul = {
|
||||||
|
source = "hashicorp/consul"
|
||||||
|
version = "2.22.0" # 使用已有的版本
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 从Consul获取韩国区域配置
|
||||||
|
data "consul_keys" "oracle_config_kr" {
|
||||||
|
key {
|
||||||
|
name = "tenancy_ocid"
|
||||||
|
path = "config/dev/oracle/kr/tenancy_ocid"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "user_ocid"
|
||||||
|
path = "config/dev/oracle/kr/user_ocid"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "fingerprint"
|
||||||
|
path = "config/dev/oracle/kr/fingerprint"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "private_key_path"
|
||||||
|
path = "config/dev/oracle/kr/private_key_path"
|
||||||
|
}
|
||||||
|
key {
|
||||||
|
name = "region"
|
||||||
|
path = "config/dev/oracle/kr/region"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 从Consul获取美国区域配置
|
||||||
|
data "consul_keys" "oracle_config_us" {
|
||||||
|
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" {
|
||||||
|
tenancy_ocid = data.consul_keys.oracle_config_kr.var.tenancy_ocid
|
||||||
|
user_ocid = data.consul_keys.oracle_config_kr.var.user_ocid
|
||||||
|
fingerprint = data.consul_keys.oracle_config_kr.var.fingerprint
|
||||||
|
private_key_path = data.consul_keys.oracle_config_kr.var.private_key_path
|
||||||
|
region = data.consul_keys.oracle_config_kr.var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
# 美国区域Provider
|
||||||
|
provider "oci" {
|
||||||
|
alias = "us"
|
||||||
|
tenancy_ocid = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
||||||
|
user_ocid = data.consul_keys.oracle_config_us.var.user_ocid
|
||||||
|
fingerprint = data.consul_keys.oracle_config_us.var.fingerprint
|
||||||
|
private_key_path = data.consul_keys.oracle_config_us.var.private_key_path
|
||||||
|
region = data.consul_keys.oracle_config_us.var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
# 测试韩国区域连接
|
||||||
|
data "oci_identity_compartments" "kr_compartments" {
|
||||||
|
compartment_id = data.consul_keys.oracle_config_kr.var.tenancy_ocid
|
||||||
|
}
|
||||||
|
|
||||||
|
# 测试美国区域连接
|
||||||
|
data "oci_identity_compartments" "us_compartments" {
|
||||||
|
provider = oci.us
|
||||||
|
compartment_id = data.consul_keys.oracle_config_us.var.tenancy_ocid
|
||||||
|
}
|
||||||
|
|
||||||
|
# 输出Consul数据
|
||||||
|
output "consul_kr_config" {
|
||||||
|
value = data.consul_keys.oracle_config_kr.var
|
||||||
|
}
|
||||||
|
|
||||||
|
output "consul_us_config" {
|
||||||
|
value = data.consul_keys.oracle_config_us.var
|
||||||
|
}
|
||||||
|
|
||||||
|
# 输出OCI数据
|
||||||
|
output "kr_compartments" {
|
||||||
|
value = data.oci_identity_compartments.kr_compartments.compartments
|
||||||
|
}
|
||||||
|
|
||||||
|
output "us_compartments" {
|
||||||
|
value = data.oci_identity_compartments.us_compartments.compartments
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue