From 6364be2aaa473d565522dc05d826792e4bbd0d14 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Thu, 24 Feb 2022 17:06:56 -0600 Subject: [PATCH] Filestore module should allow specification of project_id w/o defaulting to provider value --- resources/file-system/filestore/README.md | 1 + resources/file-system/filestore/main.tf | 2 ++ resources/file-system/filestore/module.json | 7 +++++++ resources/file-system/filestore/variables.tf | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/resources/file-system/filestore/README.md b/resources/file-system/filestore/README.md index 1a31b5a155..f72c6a3fc2 100644 --- a/resources/file-system/filestore/README.md +++ b/resources/file-system/filestore/README.md @@ -91,6 +91,7 @@ No modules. | [local\_mount](#input\_local\_mount) | Mountpoint for this filestore instance. | `string` | `"/shared"` | no | | [name](#input\_name) | The resource name of the instance. | `string` | `null` | no | | [network\_name](#input\_network\_name) | The name of the GCE VPC network to which the instance is connected. | `string` | n/a | yes | +| [project\_id](#input\_project\_id) | ID of project in which Filestore instance will be created. | `string` | n/a | yes | | [size\_gb](#input\_size\_gb) | Storage size of the filestore instance in GB. | `number` | `2660` | no | | [zone](#input\_zone) | The name of the Filestore zone of the instance. | `string` | n/a | yes | diff --git a/resources/file-system/filestore/main.tf b/resources/file-system/filestore/main.tf index 5a8d1fa56c..555c956bd6 100644 --- a/resources/file-system/filestore/main.tf +++ b/resources/file-system/filestore/main.tf @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + resource "random_id" "resource_name_suffix" { byte_length = 4 } @@ -22,6 +23,7 @@ locals { } resource "google_filestore_instance" "filestore_instance" { + project = var.project_id provider = google-beta depends_on = [var.network_name] diff --git a/resources/file-system/filestore/module.json b/resources/file-system/filestore/module.json index f406713f13..62aa557a69 100644 --- a/resources/file-system/filestore/module.json +++ b/resources/file-system/filestore/module.json @@ -51,6 +51,13 @@ "default": null, "required": true }, + { + "name": "project_id", + "type": "string", + "description": "ID of project in which Filestore instance will be created.", + "default": null, + "required": true + }, { "name": "size_gb", "type": "number", diff --git a/resources/file-system/filestore/variables.tf b/resources/file-system/filestore/variables.tf index 1f1e49d3a9..d0bc71213d 100644 --- a/resources/file-system/filestore/variables.tf +++ b/resources/file-system/filestore/variables.tf @@ -14,6 +14,11 @@ * limitations under the License. */ +variable "project_id" { + description = "ID of project in which Filestore instance will be created." + type = string +} + variable "deployment_name" { description = "Name of the HPC deployment, used as name of the filestore instace if no name is specified." type = string