Skip to content

Commit

Permalink
Removing redundant variable kms_project_id from setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nb-goog committed Dec 11, 2024
1 parent 3991e02 commit 8d4b928
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 15 deletions.
Empty file removed .terraform.lock
Empty file.
4 changes: 2 additions & 2 deletions examples/autokey_setup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

variable "kms_project_id" {
description = "The ID of the project in which kms keyring and kms keys will be provisioned by autokey."
description = "The ID of the project in which KMS keyring and KMS keys will be provisioned by autokey."
type = string
}

variable "folder_id" {
type = string
description = "The ID of the folder for which to configure and enable Autokey feature. Required when using Autokey."
description = "The ID of the folder for which to configure and enable Autokey feature."
}

2 changes: 1 addition & 1 deletion examples/bucket_setup_using_autokey/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ resource "google_kms_key_handle" "bucket_keyhandle" {

module "bucket" {
source = "terraform-google-modules/cloud-storage/google//modules/simple_bucket"
version = "8.0"
version = "~> 8.0.3"

name = "${var.resource_project_id}-bucket-${random_string.suffix.result}"
project_id = var.resource_project_id
Expand Down
4 changes: 2 additions & 2 deletions examples/bucket_setup_using_autokey/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

output "bucket_keyhandle" {
description = "An Autokey configuration identifier."
description = "Keyhandle configuration created for the bucket."
value = resource.google_kms_key_handle.bucket_keyhandle
}

output "bucket_name" {
description = "A map of KeyHandles created."
description = "Name of the bucket created."
value = module.bucket.name
}
8 changes: 4 additions & 4 deletions examples/bucket_setup_using_autokey/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
*/

variable "kms_project_id" {
description = "The ID of the project in which kms keyring and kms keys will be provisioned by autokey."
description = "The ID of the project in which KMS keyring and KMS keys will be provisioned by autokey."
type = string
}

variable "folder_id" {
type = string
description = "The ID of the folder for which to configure and enable Autokey feature. Required when using Autokey."
description = "The ID of the folder for which to configure and enable Autokey feature."
}

variable "resource_project_id" {
description = "The ID of the project in which to provision resources (bucket, persistent disk, etc)"
description = "The ID of the project in which to provision cloud storage bucket resource."
type = string
}

variable "bucket_location" {
type = string
description = "The gcp location where storage bucket will be created"
description = "The GCP location where storage bucket will be created"
default = "us-central1"
}
3 changes: 1 addition & 2 deletions modules/autokey/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Autokey submodule

This is a submodule built to make [KMS Autokey](https://cloud.google.com/kms/docs/autokey-overview) feature simple to be used. This submodule will create the [Autokey Config](https://cloud.google.com/kms/docs/enable-autokey#enable-autokey-folder) for an existing folder where you want to enable Autokey, set up the Cloud KMS [service agent](https://cloud.google.com/kms/docs/enable-autokey#autokey-service-agent) on an existing key project and create [Key Handles](https://cloud.google.com/kms/docs/resource-hierarchy#key_handles) for existing resource projects.

This is a submodule built to make [KMS Autokey](https://cloud.google.com/kms/docs/autokey-overview) feature simple to be used. This submodule will create the [Autokey Config](https://cloud.google.com/kms/docs/enable-autokey#enable-autokey-folder) for an existing folder where you want to enable Autokey, set up the Cloud KMS [service agent](https://cloud.google.com/kms/docs/enable-autokey#autokey-service-agent) on an existing key project.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/autokey_setup_fixture/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "autokey_setup_fixture" {
source = "../../../examples/autokey_setup"
kms_project_id = var.project_id
folder_id = var.folder_id
}
25 changes: 25 additions & 0 deletions test/fixtures/autokey_setup_fixture/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2024 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 "autokey_config_id" {
description = "An Autokey configuration identifier."
value = module.autokey_setup_fixture.autokey_config_id
}

output "kms_project_id" {
description = "The ID of the project in which KMS keyring and KMS keys will be provisioned by autokey."
value = var.project_id
}
26 changes: 26 additions & 0 deletions test/fixtures/autokey_setup_fixture/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2024 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 "project_id" {
description = "The ID of the project in which KMS keyring and KMS keys will be provisioned by autokey."
type = string
}

variable "folder_id" {
description = "The ID of the folder for which to configure and enable Autokey feature."
type = string

}
7 changes: 7 additions & 0 deletions test/fixtures/bucket_setup_using_autokey_fixture/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "bucket_setup_using_autokey_fixture" {
source = "../../../examples/bucket_setup_using_autokey"
kms_project_id = var.project_id
folder_id = var.folder_id
resource_project_id = var.resource_project_id
bucket_location = var.bucket_location
}
25 changes: 25 additions & 0 deletions test/fixtures/bucket_setup_using_autokey_fixture/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2024 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 "bucket_keyhandle" {
description = "Keyhandle configuration created for the bucket."
value = module.bucket_setup_using_autokey_fixture.bucket_keyhandle
}

output "bucket_name" {
description = "Name of the bucket created."
value = module.bucket_setup_using_autokey_fixture.bucket_name
}
36 changes: 36 additions & 0 deletions test/fixtures/bucket_setup_using_autokey_fixture/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright 2024 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 "project_id" {
description = "The ID of the project in which KMS keyring and KMS keys will be provisioned by autokey."
type = string
}

variable "folder_id" {
type = string
description = "The ID of the folder for which to configure and enable Autokey feature."
}

variable "resource_project_id" {
description = "The ID of the project in which to provision cloud storage bucket resources."
type = string
}

variable "bucket_location" {
type = string
description = "The GCP location where storage bucket will be created"
default = "us-central1"
}
4 changes: 0 additions & 4 deletions test/setup/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

output "kms_project_id" {
value = module.project_ci_kms.project_id
}

output "project_id" {
value = module.project_ci_kms.project_id
}
Expand Down

0 comments on commit 8d4b928

Please sign in to comment.