Skip to content
36 changes: 36 additions & 0 deletions looker/looker-core-psc/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright 2025 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.
*/
# [START looker_google_looker_instance_psc]
# Create an ENTERPRISE edition Looker (Google Cloud core) instance that has PSC enabled.
resource "google_looker_instance" "default" {
name = "my-instance"
platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL"
region = "us-central1"
private_ip_enabled = false
public_ip_enabled = false
psc_enabled = true
oauth_config {
client_id = "my-client-id"
client_secret = "my-client-secret"
}
psc_config {
allowed_vpcs = ["projects/test-project/global/networks/test"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value won't work, as test-project is not a valid project ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comments in the sample. The test-project and test parts of the VPC URL are unique to the user's project, so the value here is just an example.

# (Optional) List of VPCs that are allowed ingress into the Looker instance.
service_attachments = [{local_fqdn: "www.local-fqdn.com" target_service_attachment_uri: "projects/my-project/regions/us-east1/serviceAttachments/sa"}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading the docs correctly, you don't set these values, they are updated for you. Trying to validate this part of the Terraform is failing with An argument named "service_attachments" is not expected here.. Are you able to confirm this is intended as an argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I get it! So the service attachment argument is relevant only when updating an instance config, not when creating it. I think that to match the other blocks in https://cloud.google.com/looker/docs/looker-core-create-psc#create_instance we should remove that argument entirely.

As for the allowed_vpcs, you would only specify that if you are creating an instance that uses only private IP (that is:

private_ip_enabled = true
public_ip_enabled  = false
psc_enabled  = true

This example doesn't follow that pattern, so I have commented out the allowed_vpcs and added some context.

# (Optional) List of egress service attachment configurations. local_fqdn is a fully qualified domain name that will be used in the private DNS record created for the service attachment. target_service_attachment_uri is the URI of the service attachment to connect to.
}
}
# [END looker_google_looker_instance_psc]
20 changes: 20 additions & 0 deletions looker/looker-core-psc/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 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.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: looker_core_psc
spec:
skip: true
Loading