Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add golden copy tests for terraform IGC #1204

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

deployment_metadata:
- name: zero
deployment_inputs:
- deployment_name
- labels
- project_id
- region
intergroup_inputs: []
outputs:
- nat_ips_network0
- network_id_network0
- subnetwork_name_network0
- name: one
deployment_inputs:
- deployment_name
- labels
- project_id
- region
- zone
intergroup_inputs:
- network_id_network0
- subnetwork_name_network0
outputs: []
29 changes: 29 additions & 0 deletions tools/validate_configs/golden_copies/terraform_igc/one/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module "homefs" {
source = "./modules/embedded/modules/file-system/filestore"
deployment_name = var.deployment_name
labels = merge(var.labels, {
ghpc_role = "file-system"
})
local_mount = "/home"
name = var.subnetwork_name_network0
network_id = var.network_id_network0
project_id = var.project_id
region = var.region
zone = var.zone
}

15 changes: 15 additions & 0 deletions tools/validate_configs/golden_copies/terraform_igc/one/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
provider "google" {
project = var.project_id
zone = var.zone
region = var.region
}

provider "google-beta" {
project = var.project_id
zone = var.zone
region = var.region
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
deployment_name = "golden_copy_deployment"
labels = {
ghpc_blueprint = "igc"
ghpc_deployment = "golden_copy_deployment"
}
project_id = "invalid-project"
region = "us-east4"
zone = "us-east4-c"
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

variable "deployment_name" {
description = "Toolkit deployment variable: deployment_name"
type = string
}

variable "labels" {
description = "Toolkit deployment variable: labels"
type = any
}

variable "network_id_network0" {
description = "Toolkit automatically generated variable: network_id_network0"
type = any
}

variable "project_id" {
description = "Toolkit deployment variable: project_id"
type = string
}

variable "region" {
description = "Toolkit deployment variable: region"
type = string
}

variable "subnetwork_name_network0" {
description = "Toolkit automatically generated variable: subnetwork_name_network0"
type = any
}

variable "zone" {
description = "Toolkit deployment variable: zone"
type = string
}
30 changes: 30 additions & 0 deletions tools/validate_configs/golden_copies/terraform_igc/one/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

terraform {
required_version = ">= 0.13"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.61.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.61.0"
}
}
}
22 changes: 22 additions & 0 deletions tools/validate_configs/golden_copies/terraform_igc/zero/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module "network0" {
source = "./modules/embedded/modules/network/vpc"
deployment_name = var.deployment_name
project_id = var.project_id
region = var.region
}

31 changes: 31 additions & 0 deletions tools/validate_configs/golden_copies/terraform_igc/zero/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

output "nat_ips_network0" {
description = "Generated output from module 'network0'"
value = module.network0.nat_ips
}

output "subnetwork_name_network0" {
description = "Generated output from module 'network0'"
value = module.network0.subnetwork_name
}

output "network_id_network0" {
description = "Automatically-generated output exported for use by later deployment groups"
value = module.network0.network_id
sensitive = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
provider "google" {
project = var.project_id
region = var.region
}

provider "google-beta" {
project = var.project_id
region = var.region
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
deployment_name = "golden_copy_deployment"
labels = {
ghpc_blueprint = "igc"
ghpc_deployment = "golden_copy_deployment"
}
project_id = "invalid-project"
region = "us-east4"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

variable "deployment_name" {
description = "Toolkit deployment variable: deployment_name"
type = string
}

variable "labels" {
description = "Toolkit deployment variable: labels"
type = any
}

variable "project_id" {
description = "Toolkit deployment variable: project_id"
type = string
}

variable "region" {
description = "Toolkit deployment variable: region"
type = string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

terraform {
required_version = ">= 0.13"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.61.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.61.0"
}
}
}
Loading