make tests for notifications provider agnostic
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
committed by
Sunny
parent
7c1b897919
commit
e63ddb99de
13
tests/integration/terraform/gcp/gke.tf
Normal file
13
tests/integration/terraform/gcp/gke.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
module "gke" {
|
||||
source = "git::https://github.com/fluxcd/test-infra.git//tf-modules/gcp/gke"
|
||||
|
||||
name = local.name
|
||||
tags = var.tags
|
||||
}
|
||||
|
||||
module "gcr" {
|
||||
source = "git::https://github.com/fluxcd/test-infra.git//tf-modules/gcp/gcr"
|
||||
|
||||
name = local.name
|
||||
tags = var.tags
|
||||
}
|
||||
18
tests/integration/terraform/gcp/kms.tf
Normal file
18
tests/integration/terraform/gcp/kms.tf
Normal file
@@ -0,0 +1,18 @@
|
||||
data "google_kms_key_ring" "keyring" {
|
||||
name = var.gcp_keyring
|
||||
location = "global"
|
||||
}
|
||||
|
||||
data "google_kms_crypto_key" "my_crypto_key" {
|
||||
name = var.gcp_crypto_key
|
||||
key_ring = data.google_kms_key_ring.keyring.id
|
||||
}
|
||||
|
||||
resource "google_kms_key_ring_iam_binding" "key_ring" {
|
||||
key_ring_id = data.google_kms_key_ring.keyring.id
|
||||
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
|
||||
|
||||
members = [
|
||||
"serviceAccount:${data.google_project.project.number}-compute@developer.gserviceaccount.com",
|
||||
]
|
||||
}
|
||||
@@ -6,44 +6,8 @@ provider "google" {
|
||||
|
||||
resource "random_pet" "suffix" {}
|
||||
|
||||
data "google_kms_key_ring" "keyring" {
|
||||
name = var.gcp_keyring
|
||||
location = "global"
|
||||
locals {
|
||||
name = "e2e-${random_pet.suffix.id}"
|
||||
}
|
||||
|
||||
data "google_kms_crypto_key" "my_crypto_key" {
|
||||
name = var.gcp_crypto_key
|
||||
key_ring = data.google_kms_key_ring.keyring.id
|
||||
}
|
||||
|
||||
data "google_project" "project" {
|
||||
}
|
||||
|
||||
module "gke" {
|
||||
source = "git::https://github.com/fluxcd/test-infra.git//tf-modules/gcp/gke"
|
||||
name = "flux-e2e-${random_pet.suffix.id}"
|
||||
tags = var.tags
|
||||
}
|
||||
|
||||
module "gcr" {
|
||||
source = "git::https://github.com/fluxcd/test-infra.git//tf-modules/gcp/gcr"
|
||||
name = "flux-e2e-${random_pet.suffix.id}"
|
||||
tags = var.tags
|
||||
}
|
||||
|
||||
resource "google_sourcerepo_repository" "fleet-infra" {
|
||||
name = "fleet-infra-${random_pet.suffix.id}"
|
||||
}
|
||||
|
||||
resource "google_sourcerepo_repository" "application" {
|
||||
name = "application-${random_pet.suffix.id}"
|
||||
}
|
||||
|
||||
resource "google_kms_key_ring_iam_binding" "key_ring" {
|
||||
key_ring_id = data.google_kms_key_ring.keyring.id
|
||||
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
|
||||
|
||||
members = [
|
||||
"serviceAccount:${data.google_project.project.number}-compute@developer.gserviceaccount.com",
|
||||
]
|
||||
}
|
||||
data "google_project" "project" {}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
output "kubeconfig" {
|
||||
output "gke_kubeconfig" {
|
||||
value = module.gke.kubeconfig
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
output "gcp_project" {
|
||||
output "gcp_project_id" {
|
||||
value = var.gcp_project_id
|
||||
}
|
||||
|
||||
@@ -19,10 +19,14 @@ output "sops_id" {
|
||||
value = data.google_kms_crypto_key.my_crypto_key.id
|
||||
}
|
||||
|
||||
output "fleet_infra_url" {
|
||||
output "fleet_infra_repository" {
|
||||
value = "ssh://${var.gcp_email}@source.developers.google.com:2022/p/${var.gcp_project_id}/r/${google_sourcerepo_repository.fleet-infra.name}"
|
||||
}
|
||||
|
||||
output "application_url" {
|
||||
output "application_repository" {
|
||||
value = "ssh://${var.gcp_email}@source.developers.google.com:2022/p/${var.gcp_project_id}/r/${google_sourcerepo_repository.application.name}"
|
||||
}
|
||||
|
||||
output "pubsub_topic" {
|
||||
value = google_pubsub_topic.pubsub.name
|
||||
}
|
||||
|
||||
11
tests/integration/terraform/gcp/pubsub.tf
Normal file
11
tests/integration/terraform/gcp/pubsub.tf
Normal file
@@ -0,0 +1,11 @@
|
||||
resource "google_pubsub_topic" "pubsub" {
|
||||
name = local.name
|
||||
labels = var.tags
|
||||
message_retention_duration = "7200s"
|
||||
}
|
||||
|
||||
resource "google_pubsub_subscription" "sub" {
|
||||
project = var.gcp_project_id
|
||||
name = local.name
|
||||
topic = google_pubsub_topic.pubsub.name
|
||||
}
|
||||
7
tests/integration/terraform/gcp/sourcerepo.tf
Normal file
7
tests/integration/terraform/gcp/sourcerepo.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
resource "google_sourcerepo_repository" "fleet-infra" {
|
||||
name = "fleet-infra-${random_pet.suffix.id}"
|
||||
}
|
||||
|
||||
resource "google_sourcerepo_repository" "application" {
|
||||
name = "application-${random_pet.suffix.id}"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ variable "gcp_project_id" {
|
||||
|
||||
variable "gcp_email" {
|
||||
type = string
|
||||
description = "GCP email"
|
||||
description = "GCP user email"
|
||||
}
|
||||
|
||||
variable "gcp_region" {
|
||||
@@ -17,10 +17,9 @@ variable "gcp_region" {
|
||||
variable "gcp_zone" {
|
||||
type = string
|
||||
default = "us-central1"
|
||||
description = "GCP region"
|
||||
description = "GCP zone"
|
||||
}
|
||||
|
||||
|
||||
variable "gcp_keyring" {
|
||||
type = string
|
||||
description = "GCP keyring that contains crypto key for encrypting secrets"
|
||||
@@ -32,6 +31,7 @@ variable "gcp_crypto_key" {
|
||||
}
|
||||
|
||||
variable "tags" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
type = map(string)
|
||||
default = {}
|
||||
description = "tags for created resources"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user