mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 15:13:56 -06:00
kubernetes: Add GKE config as test infrastructure
This commit is contained in:
parent
f1db0fcf9b
commit
eb08f40199
63
builtin/providers/kubernetes/test-infra/main.tf
Normal file
63
builtin/providers/kubernetes/test-infra/main.tf
Normal file
@ -0,0 +1,63 @@
|
||||
provider "google" {
|
||||
// Provider settings to be provided via ENV variables
|
||||
}
|
||||
|
||||
data "google_compute_zones" "available" {}
|
||||
|
||||
resource "random_id" "cluster_name" {
|
||||
byte_length = 10
|
||||
}
|
||||
resource "random_id" "username" {
|
||||
byte_length = 14
|
||||
}
|
||||
resource "random_id" "password" {
|
||||
byte_length = 16
|
||||
}
|
||||
|
||||
resource "google_container_cluster" "primary" {
|
||||
name = "tf-acc-test-${random_id.cluster_name.hex}"
|
||||
zone = "${data.google_compute_zones.available.names[0]}"
|
||||
initial_node_count = 3
|
||||
|
||||
additional_zones = [
|
||||
"${data.google_compute_zones.available.names[1]}"
|
||||
]
|
||||
|
||||
master_auth {
|
||||
username = "${random_id.username.hex}"
|
||||
password = "${random_id.password.hex}"
|
||||
}
|
||||
|
||||
node_config {
|
||||
oauth_scopes = [
|
||||
"https://www.googleapis.com/auth/compute",
|
||||
"https://www.googleapis.com/auth/devstorage.read_only",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
"https://www.googleapis.com/auth/monitoring"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
output "endpoint" {
|
||||
value = "${google_container_cluster.primary.endpoint}"
|
||||
}
|
||||
|
||||
output "username" {
|
||||
value = "${google_container_cluster.primary.master_auth.0.username}"
|
||||
}
|
||||
|
||||
output "password" {
|
||||
value = "${google_container_cluster.primary.master_auth.0.password}"
|
||||
}
|
||||
|
||||
output "client_certificate_b64" {
|
||||
value = "${google_container_cluster.primary.master_auth.0.client_certificate}"
|
||||
}
|
||||
|
||||
output "client_key_b64" {
|
||||
value = "${google_container_cluster.primary.master_auth.0.client_key}"
|
||||
}
|
||||
|
||||
output "cluster_ca_certificate_b64" {
|
||||
value = "${google_container_cluster.primary.master_auth.0.cluster_ca_certificate}"
|
||||
}
|
Loading…
Reference in New Issue
Block a user