Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Reinstated filestore tests (#5543) (#440)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 15, 2021
1 parent 7930b73 commit f64a4b8
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestCLI(t *testing.T) {
{name: "example_container_cluster"},
{name: "example_dns_managed_zone"},
{name: "example_dns_policy"},
{name: "example_filestore_instance"},
{name: "example_kms_crypto_key"},
{name: "example_kms_crypto_key_iam_binding"},
{name: "example_kms_crypto_key_iam_member"},
Expand Down
1 change: 1 addition & 0 deletions test/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestReadPlannedAssetsCoverage(t *testing.T) {
{name: "example_container_cluster"},
{name: "example_dns_managed_zone"},
{name: "example_dns_policy"},
{name: "example_filestore_instance"},
{name: "example_kms_crypto_key"},
{name: "example_kms_crypto_key_iam_binding"},
{name: "example_kms_crypto_key_iam_member"},
Expand Down
30 changes: 30 additions & 0 deletions testdata/templates/example_filestore_instance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"name": "//file.googleapis.com/projects/{{.Provider.project}}/locations/us-central1-b/instances/test-instance",
"asset_type": "file.googleapis.com/Instance",
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
"resource": {
"version": "v1",
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/file/v1/rest",
"discovery_name": "Instance",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"fileShares": [
{
"capacityGb": 2660,
"name": "share1"
}
],
"networks": [
{
"modes": [
"MODE_IPV4"
],
"network": "default"
}
],
"tier": "BASIC_SSD"
}
}
}
]
44 changes: 44 additions & 0 deletions testdata/templates/example_filestore_instance.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2019 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_providers {
google = {
source = "hashicorp/google"
version = "~> {{.Provider.version}}"
}
}
}

provider "google" {
{{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
}

resource "google_filestore_instance" "test" {
name = "test-instance"
location = "us-central1-b"
tier = "BASIC_SSD"

file_shares {
capacity_gb = 2660
name = "share1"
}

networks {
network = "default"
modes = ["MODE_IPV4"]
}
}
157 changes: 157 additions & 0 deletions testdata/templates/example_filestore_instance.tfplan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"format_version": "0.1",
"terraform_version": "0.13.5",
"planned_values": {
"root_module": {
"resources": [
{
"address": "google_filestore_instance.test",
"mode": "managed",
"type": "google_filestore_instance",
"name": "test",
"provider_name": "registry.terraform.io/hashicorp/google",
"schema_version": 0,
"values": {
"description": null,
"file_shares": [
{
"capacity_gb": 2660,
"name": "share1"
}
],
"labels": null,
"name": "test-instance",
"networks": [
{
"modes": [
"MODE_IPV4"
],
"network": "default"
}
],
"tier": "BASIC_SSD",
"timeouts": null,
"location": "us-central1-b"
}
}
]
}
},
"resource_changes": [
{
"address": "google_filestore_instance.test",
"mode": "managed",
"type": "google_filestore_instance",
"name": "test",
"provider_name": "registry.terraform.io/hashicorp/google",
"change": {
"actions": [
"create"
],
"before": null,
"after": {
"description": null,
"file_shares": [
{
"capacity_gb": 2660,
"name": "share1"
}
],
"labels": null,
"name": "test-instance",
"networks": [
{
"modes": [
"MODE_IPV4"
],
"network": "default"
}
],
"tier": "BASIC_SSD",
"timeouts": null,
"location": "us-central1-b"
},
"after_unknown": {
"create_time": true,
"etag": true,
"id": true,
"networks": [
{
"ip_addresses": true,
"modes": [
false
],
"reserved_ip_range": true
}
],
"project": true
}
}
}
],
"configuration": {
"provider_config": {
"google": {
"name": "google",
"expressions": {
"project": {
"constant_value": "{{.Provider.project}}"
}
}
},
"google": {
"name": "google",
"expressions": {
"project": {
"constant_value": "{{.Provider.project}}"
}
}
}
},
"root_module": {
"resources": [
{
"address": "google_filestore_instance.test",
"mode": "managed",
"type": "google_filestore_instance",
"name": "test",
"provider_config_key": "google",
"expressions": {
"file_shares": [
{
"capacity_gb": {
"constant_value": 2660
},
"name": {
"constant_value": "share1"
}
}
],
"name": {
"constant_value": "test-instance"
},
"networks": [
{
"modes": {
"constant_value": [
"MODE_IPV4"
]
},
"network": {
"constant_value": "default"
}
}
],
"tier": {
"constant_value": "BASIC_SSD"
},
"location": {
"constant_value": "us-central1-b"
}
},
"schema_version": 0
}
]
}
}
}

0 comments on commit f64a4b8

Please sign in to comment.