From 29eb7e2cd361076f17c9c565be74cb8ebd2fd6df Mon Sep 17 00:00:00 2001 From: abhishek kumar tiwari Date: Wed, 27 Nov 2024 19:28:42 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Update=20variable's=20order=20in=20varia?= =?UTF-8?q?bles.tf=20and=20update=20display=20metad=E2=80=A6=20(#368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/simple_bucket/metadata.display.yaml | 3 ++ modules/simple_bucket/metadata.yaml | 50 ++++++++++----------- modules/simple_bucket/variables.tf | 40 ++++++++--------- 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/modules/simple_bucket/metadata.display.yaml b/modules/simple_bucket/metadata.display.yaml index e098d4c4..3fe82f87 100644 --- a/modules/simple_bucket/metadata.display.yaml +++ b/modules/simple_bucket/metadata.display.yaml @@ -46,6 +46,7 @@ spec: force_destroy: name: force_destroy title: Force Destroy + invisible: false iam_members: name: iam_members title: Iam Members @@ -67,6 +68,8 @@ spec: name: name: name title: Name + regexValidation: ^[a-z0-9][a-z0-9-_.]{2,61}[a-z0-9]$ + validation: Use lowercase letters, numbers,underscores, periods and hyphens. Start with a letter/number and end with letter/number. Must be between 3 and 63 characters. project_id: name: project_id title: Project Id diff --git a/modules/simple_bucket/metadata.yaml b/modules/simple_bucket/metadata.yaml index fbaaf548..cb4678db 100644 --- a/modules/simple_bucket/metadata.yaml +++ b/modules/simple_bucket/metadata.yaml @@ -38,10 +38,6 @@ spec: location: examples/simple_bucket interfaces: variables: - - name: name - description: The name of the bucket. - varType: string - required: true - name: project_id description: The ID of the project to create the bucket in. varType: string @@ -50,24 +46,10 @@ spec: description: The location of the bucket. See https://cloud.google.com/storage/docs/locations. varType: string required: true - - name: storage_class - description: The Storage Class of the new bucket. + - name: name + description: The name of the bucket. varType: string - - name: labels - description: A set of key/value label pairs to assign to the bucket. - varType: map(string) - - name: bucket_policy_only - description: Enables Bucket Policy Only access to a bucket. - varType: bool - defaultValue: true - - name: versioning - description: While set to true, versioning is fully enabled for this bucket. - varType: bool - defaultValue: true - - name: autoclass - description: While set to true, autoclass is enabled for this bucket. - varType: bool - defaultValue: false + required: true - name: force_destroy description: When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. varType: bool @@ -83,14 +65,32 @@ spec: connections: - source: source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 - version: ~> 0.13 + version: ">= 0.13" spec: - outputExpr: '{"member": service_account_id.member, "role": "roles/storage.objectAdmin"}' + outputExpr: "{\"member\": service_account_id.member, \"role\": \"roles/storage.objectAdmin\"}" - source: source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa - version: ~> 4.4 + version: ">= 4.4" spec: - outputExpr: '{"member": iam_email, "role": "roles/storage.objectAdmin"}' + outputExpr: "{\"member\": iam_email, \"role\": \"roles/storage.objectAdmin\"}" + - name: storage_class + description: The Storage Class of the new bucket. + varType: string + - name: labels + description: A set of key/value label pairs to assign to the bucket. + varType: map(string) + - name: bucket_policy_only + description: Enables Bucket Policy Only access to a bucket. + varType: bool + defaultValue: true + - name: versioning + description: While set to true, versioning is fully enabled for this bucket. + varType: bool + defaultValue: true + - name: autoclass + description: While set to true, autoclass is enabled for this bucket. + varType: bool + defaultValue: false - name: retention_policy description: Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. varType: |- diff --git a/modules/simple_bucket/variables.tf b/modules/simple_bucket/variables.tf index 58fdf10e..5a574e97 100644 --- a/modules/simple_bucket/variables.tf +++ b/modules/simple_bucket/variables.tf @@ -14,11 +14,6 @@ * limitations under the License. */ -variable "name" { - description = "The name of the bucket." - type = string -} - variable "project_id" { description = "The ID of the project to create the bucket in." type = string @@ -29,6 +24,26 @@ variable "location" { type = string } +variable "name" { + description = "The name of the bucket." + type = string +} + +variable "force_destroy" { + description = "When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects." + type = bool + default = false +} + +variable "iam_members" { + description = "The list of IAM members to grant permissions on the bucket." + type = list(object({ + role = string + member = string + })) + default = [] +} + variable "storage_class" { description = "The Storage Class of the new bucket." type = string @@ -60,21 +75,6 @@ variable "autoclass" { default = false } -variable "force_destroy" { - description = "When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects." - type = bool - default = false -} - -variable "iam_members" { - description = "The list of IAM members to grant permissions on the bucket." - type = list(object({ - role = string - member = string - })) - default = [] -} - variable "retention_policy" { description = "Configuration of the bucket's data retention policy for how long objects in the bucket should be retained." type = object({