Skip to content

Commit

Permalink
retry
Browse files Browse the repository at this point in the history
  • Loading branch information
Esanim committed Feb 19, 2024
1 parent 6195654 commit f4ccd6b
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions test/terramate_google.tm.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
globals {
minimum_provider_version = "4.0"
provider_version_constraint = "~> ${global.minimum_provider_version}"

stack_basename = tm_reverse(tm_split("/", terramate.path))[0]
}

generate_hcl "_generated_google.tf" {
# condition = global.provider == "google"
content {
variable "gcp_project" {
type = string
description = "(Required) The ID of the project in which the resource belongs."
}

variable "gcp_region" {
type = string
description = "(Optional) The gcp region in which all resources will be created."
default = "europe-west3"
}

variable "gcp_org_domain" {
type = string
description = "(Optional) The domain of the organization test projects should be created in."
default = null
}

variable "gcp_billing_account" {
type = string
description = "(Optional) The billing account to use when creating projects."
default = null
}

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = global.provider_version_constraint
}
random = {
source = "hashicorp/random"
version = "~> 3.1"
}
}
}

provider "google" {
project = var.gcp_project
region = var.gcp_region
}

provider "random" {}

resource "random_id" "suffix" {
count = local.test_name != "unit-disabled" ? 1 : 0
byte_length = 16
}

data "google_project" "project" {}

data "google_organization" "org" {
count = local.org_domain != null ? 1 : 0

domain = local.org_domain
}

# define default locals for all tests
locals {
test_name = global.stack_basename
random_suffix = try(random_id.suffix[0].hex, "disabled")
project_id = var.gcp_project
project_number = data.google_project.project.number
org_domain = var.gcp_org_domain
org_id = try(data.google_organization.org[0].name, null)
billing_account = var.gcp_billing_account
}
}
}

0 comments on commit f4ccd6b

Please sign in to comment.