diff --git a/mmv1/products/looker/Instance.yaml b/mmv1/products/looker/Instance.yaml new file mode 100644 index 000000000000..8435d9935a57 --- /dev/null +++ b/mmv1/products/looker/Instance.yaml @@ -0,0 +1,366 @@ +# Copyright 2023 Google Inc. +# 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. + +--- !ruby/object:Api::Resource +name: 'Instance' +base_url: projects/{{project}}/locations/{{region}}/instances +create_url: projects/{{project}}/locations/{{region}}/instances?instanceId={{name}} +update_verb: :PATCH +update_mask: true +description: | + A Google Cloud Looker instance. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/looker/docs/looker-core' + api: 'https://cloud.google.com/looker/docs/reference/rest/v1/projects.locations.instances' +timeouts: !ruby/object:Api::Timeouts + insert_minutes: 180 + update_minutes: 90 + delete_minutes: 60 +autogen_async: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: 'looker_instance_standard_basic' + primary_resource_id: 'looker-instance' + vars: + instance_name: 'my-instance' + client_id: 'my-client-id' + client_secret: 'my-client-secret' + - !ruby/object:Provider::Terraform::Examples + name: 'looker_instance_enterprise_full' + primary_resource_id: 'looker-instance' + vars: + instance_name: 'my-instance' + client_id: 'my-client-id' + client_secret: 'my-client-secret' + network_name: 'looker-test-network' +parameters: + # TODO: resourceref? + - !ruby/object:Api::Type::String + name: 'region' + description: | + The name of the Looker region of the instance. + required: false + immutable: true + url_param_only: true + ignore_read: true + default_from_api: true +properties: + # Admin Settings Object + - !ruby/object:Api::Type::NestedObject + name: adminSettings + description: | + Looker instance Admin settings. + properties: + - !ruby/object:Api::Type::Array + name: 'allowedEmailDomains' + item_type: Api::Type::String + description: | + Email domain allowlist for the instance. + + Define the email domains to which your users can deliver Looker (Google Cloud core) content. + Updating this list will restart the instance. Updating the allowed email domains from terraform + means the value provided will be considered as the entire list and not an amendment to the + existing list of allowed email domains. + # Admin Settings Object - End + - !ruby/object:Api::Type::String + name: consumerNetwork + description: | + Network name in the consumer project in the format of: projects/{project}/global/networks/{network} + Note that the consumer network may be in a different GCP project than the consumer + project that is hosting the Looker Instance. + - !ruby/object:Api::Type::Time + name: createTime + description: | + The time the instance was created in RFC3339 UTC "Zulu" format, + accurate to nanoseconds. + output: true + # Deny Maintenance Period Object + - !ruby/object:Api::Type::NestedObject + name: denyMaintenancePeriod + description: | + Maintenance denial period for this instance. + + You must allow at least 14 days of maintenance availability + between any two deny maintenance periods. + properties: + - !ruby/object:Api::Type::NestedObject + name: 'startDate' + required: true + description: | + Required. Start date of the deny maintenance period + properties: + - !ruby/object:Api::Type::Integer + name: 'year' + description: | + Year of the date. Must be from 1 to 9999, or 0 to specify a date without + a year. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,10000)' + - !ruby/object:Api::Type::Integer + name: 'month' + description: | + Month of a year. Must be from 1 to 12, or 0 to specify a year without a + month and day. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,13)' + - !ruby/object:Api::Type::Integer + name: 'day' + description: | + Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 + to specify a year by itself or a year and month where the day isn't significant. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,32)' + - !ruby/object:Api::Type::NestedObject + name: 'endDate' + required: true + description: | + Required. Start date of the deny maintenance period + properties: + - !ruby/object:Api::Type::Integer + name: 'year' + description: | + Year of the date. Must be from 1 to 9999, or 0 to specify a date without + a year. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,10000)' + - !ruby/object:Api::Type::Integer + name: 'month' + description: | + Month of a year. Must be from 1 to 12, or 0 to specify a year without a + month and day. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,13)' + - !ruby/object:Api::Type::Integer + name: 'day' + description: | + Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 + to specify a year by itself or a year and month where the day isn't significant. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,32)' + + + - !ruby/object:Api::Type::NestedObject + name: 'time' + required: true + description: | + Required. Start time of the window in UTC time. + properties: + - !ruby/object:Api::Type::Integer + name: 'hours' + description: | + Hours of day in 24 hour format. Should be from 0 to 23. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,23)' + - !ruby/object:Api::Type::Integer + name: 'minutes' + description: | + Minutes of hour of day. Must be from 0 to 59. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,60)' + - !ruby/object:Api::Type::Integer + name: 'seconds' + description: | + Seconds of minutes of the time. Must normally be from 0 to 59. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,60)' + - !ruby/object:Api::Type::Integer + name: 'nanos' + description: | + Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,999999999)' + + # Deny Maintenance Period Object - End + - !ruby/object:Api::Type::String + name: egressPublicIp + description: | + Public Egress IP (IPv4). + output: true + - !ruby/object:Api::Type::String + name: ingressPrivateIp + description: | + Private Ingress IP (IPv4). + output: true + - !ruby/object:Api::Type::String + name: ingressPublicIp + description: | + Public Ingress IP (IPv4). + output: true + - !ruby/object:Api::Type::String + name: lookerVersion + description: | + The Looker version that the instance is using. + output: true + - !ruby/object:Api::Type::String + name: lookerUri + description: | + Looker instance URI which can be used to access the Looker Instance UI. + output: true + + # Maintenance Window Object + - !ruby/object:Api::Type::NestedObject + name: maintenanceWindow + description: | + Maintenance window for an instance. + + Maintenance of your instance takes place once a month, and will require + your instance to be restarted during updates, which will temporarily + disrupt service. + properties: + - !ruby/object:Api::Type::Enum + name: 'dayOfWeek' + required: true + description: | + Required. Day of the week for this MaintenanceWindow (in UTC). + + - DAY_OF_WEEK_UNSPECIFIED: The day of the week is unspecified. + - MONDAY: Monday + - TUESDAY: Tuesday + - WEDNESDAY: Wednesday + - THURSDAY: Thursday + - FRIDAY: Friday + - SATURDAY: Saturday + - SUNDAY: Sunday + values: + - :DAY_OF_WEEK_UNSPECIFIED + - :MONDAY + - :TUESDAY + - :WEDNESDAY + - :THURSDAY + - :FRIDAY + - :SATURDAY + - :SUNDAY + - !ruby/object:Api::Type::NestedObject + name: 'startTime' + required: true + description: | + Required. Start time of the window in UTC time. + properties: + - !ruby/object:Api::Type::Integer + name: 'hours' + description: | + Hours of day in 24 hour format. Should be from 0 to 23. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,23)' + - !ruby/object:Api::Type::Integer + name: 'minutes' + description: | + Minutes of hour of day. Must be from 0 to 59. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,60)' + - !ruby/object:Api::Type::Integer + name: 'seconds' + description: | + Seconds of minutes of the time. Must normally be from 0 to 59. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,60)' + - !ruby/object:Api::Type::Integer + name: 'nanos' + description: | + Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.IntBetween(0,999999999)' + # Maintenance Window Object - End + - !ruby/object:Api::Type::String + name: name + description: | + The ID of the instance or a fully qualified identifier for the instance. + required: true + immutable: true + url_param_only: true + validation: !ruby/object:Provider::Terraform::Validation + regex: '^[a-z][a-z0-9-]{0,39}[a-z0-9]$' + # Oauth Object + - !ruby/object:Api::Type::NestedObject + name: oauthConfig + ignore_read: true + description: | + Looker Instance OAuth login settings. + properties: + - !ruby/object:Api::Type::String + name: 'clientId' + description: | + The client ID for the Oauth config. + - !ruby/object:Api::Type::String + name: 'clientSecret' + description: | + The client secret for the Oauth config. + # Oauth Object - End + - !ruby/object:Api::Type::Enum + name: platformEdition + description: | + Platform editions for a Looker instance. Each edition maps to a set of instance features, like its size. Must be one of these values: + - LOOKER_CORE_TRIAL: trial instance + - LOOKER_CORE_STANDARD: pay as you go standard instance + - LOOKER_CORE_STANDARD_ANNUAL: subscription standard instance + - LOOKER_CORE_ENTERPRISE_ANNUAL: subscription enterprise instance + - LOOKER_CORE_EMBED_ANNUAL: subscription embed instance + - LOOKER_MODELER: standalone modeling service + values: + - :LOOKER_CORE_TRIAL + - :LOOKER_CORE_STANDARD + - :LOOKER_CORE_STANDARD_ANNUAL + - :LOOKER_CORE_ENTERPRISE_ANNUAL + - :LOOKER_CORE_EMBED_ANNUAL + - :LOOKER_MODELER + default_value: :LOOKER_CORE_TRIAL + immutable: true + - !ruby/object:Api::Type::Boolean + name: privateIpEnabled + description: | + Whether private IP is enabled on the Looker instance. + default_value: false + - !ruby/object:Api::Type::Boolean + name: publicIpEnabled + description: | + Whether public IP is enabled on the Looker instance. + default_value: true + - !ruby/object:Api::Type::String + name: reservedRange + description: | + Name of a reserved IP address range within the consumer network, to be used for + private service access connection. User may or may not specify this in a request. + - !ruby/object:Api::Type::Time + name: updateTime + description: | + The time the instance was updated in RFC3339 UTC "Zulu" format, + accurate to nanoseconds. + output: true + # UserMetadata Object + - !ruby/object:Api::Type::NestedObject + name: userMetadata + description: | + Metadata about users for a Looker instance. + + There are ten Standard and two Developer users included in the cost of the product. + You can allocate additional Standard, Viewer, and Developer users for this instance. + It is an optional step and can be modified later. + + With the Standard edition of Looker (Google Cloud core), you can provision up to 50 + total users, distributed across Viewer, Standard, and Developer. + properties: + - !ruby/object:Api::Type::Integer + name: 'additionalViewerUserCount' + description: | + Number of additional Viewer Users to allocate to the Looker Instance. + - !ruby/object:Api::Type::Integer + name: 'additionalStandardUserCount' + description: | + Number of additional Standard Users to allocate to the Looker Instance. + - !ruby/object:Api::Type::Integer + name: 'additionalDeveloperUserCount' + description: | + Number of additional Developer Users to allocate to the Looker Instance. + # UserMetadata Object - End + diff --git a/mmv1/products/looker/product.yaml b/mmv1/products/looker/product.yaml new file mode 100644 index 000000000000..3864bd627ee5 --- /dev/null +++ b/mmv1/products/looker/product.yaml @@ -0,0 +1,43 @@ +# Copyright 2023 Google Inc. +# 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. + +--- !ruby/object:Api::Product +name: Looker +display_name: Looker (Goocgle Cloud core) +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://looker.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform +apis_required: + - !ruby/object:Api::Product::ApiReference + name: Looker API + url: https://console.cloud.google.com/apis/library/looker.googleapis.com/ +async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: 'name' + base_url: '{{op_id}}' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' diff --git a/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.erb b/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.erb new file mode 100644 index 000000000000..468348f944fb --- /dev/null +++ b/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.erb @@ -0,0 +1,57 @@ +resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]["instance_name"] %>" + platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL" + region = "us-central1" + private_ip_enabled = "true" + public_ip_enabled = "true" + consumer_network = data.google_compute_network.looker-network.id + reserved_range = "10.0.0.0/20" + oauth_config { + client_id = "<%= ctx[:vars]["client_id"] %>" + client_secret = "<%= ctx[:vars]["client_secret"] %>" + } + + deny_maintenance_period { + start_date { + month = 12 + day = 1 + year = 2026 + } + end_date { + month = 12 + day = 31 + year = 2026 + } + time { + hours = 10 + minutes = 0 + seconds = 0 + nanos = 0 + } + } + + maintenance_window { + day_of_week = "FRIDAY" + start_time { + hours = 17 + minutes = 0 + seconds = 0 + nanos = 0 + } + } + + admin_settings { + allowed_email_domains = ["example.com"] + } +} + // This example assumes this network already exists. + // The API creates a tenant network per network authorized for a + // Looker instance and that network is not deleted when the user-created + // network (consumer_network) is deleted, so this prevents issues + // with tenant network quota. + // If this network hasn't been created and you are using this example in your + // config, add an additional network resource or change + // this from "data"to "resource" + data "google_compute_network" "looker-network" { + name = "<%= ctx[:vars]['network_name'] %>" + } diff --git a/mmv1/templates/terraform/examples/looker_instance_standard_basic.tf.erb b/mmv1/templates/terraform/examples/looker_instance_standard_basic.tf.erb new file mode 100644 index 000000000000..1d87bfc0839e --- /dev/null +++ b/mmv1/templates/terraform/examples/looker_instance_standard_basic.tf.erb @@ -0,0 +1,17 @@ +resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]["instance_name"] %>" + platform_edition = "LOOKER_CORE_STANDARD" + region = "us-central1" + public_ip_enabled = true + oauth_config { + client_id = "<%= ctx[:vars]["client_id"] %>" + client_secret = "<%= ctx[:vars]["client_secret"] %>" + } + + user_metadata { + additional_standard_user_count = 1 + additional_viewer_user_count = 1 + additional_developer_user_count = 1 + } + +}