Looker PSC support (#3724)

* added PSC support

* added PSC support

* added PSC support

* Update README

* Add inventory

---------

Co-authored-by: Julio Castillo <jccb@google.com>
This commit is contained in:
Antonio Lopez
2026-02-10 16:22:05 +01:00
committed by GitHub
parent ddab73d03f
commit 2a37612cf3
4 changed files with 99 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ is no terraform support for these resources.
- [Examples](#examples)
- [Simple example](#simple-example)
- [Looker Core private instance with PSA](#looker-core-private-instance-with-psa)
- [Looker Core with PSC](#looker-core-with-psc)
- [Looker Core full example](#looker-core-full-example)
- [Variables](#variables)
- [Outputs](#outputs)
@@ -90,6 +91,29 @@ module "looker" {
# tftest modules=3 resources=17 inventory=psa.yaml
```
### Looker Core with PSC
```hcl
module "looker" {
source = "./fabric/modules/looker-core"
project_id = var.project_id
region = var.region
name = "looker-psc"
network_config = {
psc_config = {
allowed_vpcs = ["projects/test-project/global/networks/test"]
}
}
oauth_config = {
client_id = "xxxxxxxxx"
client_secret = "xxxxxxxx"
}
platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL"
}
# tftest inventory=psc.yaml
```
### Looker Core full example
```hcl
@@ -160,23 +184,22 @@ module "looker" {
}
# tftest modules=4 resources=23 inventory=full.yaml
```
<!-- BEGIN TFDOC -->
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [name](variables.tf#L91) | Name of the looker core instance. | <code>string</code> | ✓ | |
| [network_config](variables.tf#L96) | Network configuration for cluster and instance. Only one between psa_config and psc_config can be used. | <code title="object&#40;&#123;&#10; psa_config &#61; optional&#40;object&#40;&#123;&#10; network &#61; string&#10; allocated_ip_range &#61; optional&#40;string&#41;&#10; enable_public_ip &#61; optional&#40;bool, false&#41;&#10; enable_private_ip &#61; optional&#40;bool, true&#41;&#10; &#125;&#41;&#41;&#10; public &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | |
| [oauth_config](variables.tf#L114) | Looker Core Oauth config. Either client ID and secret (existing oauth client) or support email (temporary internal oauth client setup) must be specified. | <code title="object&#40;&#123;&#10; client_id &#61; optional&#40;string, null&#41;&#10; client_secret &#61; optional&#40;string, null&#41;&#10; support_email &#61; optional&#40;string, null&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | |
| [project_id](variables.tf#L147) | The ID of the project where this instances will be created. | <code>string</code> | ✓ | |
| [region](variables.tf#L152) | Region for the Looker core instance. | <code>string</code> | ✓ | |
| [network_config](variables.tf#L96) | Network configuration for cluster and instance. Only one between psa_config, psc_config and public can be used. | <code title="object&#40;&#123;&#10; psa_config &#61; optional&#40;object&#40;&#123;&#10; network &#61; string&#10; allocated_ip_range &#61; optional&#40;string&#41;&#10; enable_public_ip &#61; optional&#40;bool, false&#41;&#10; enable_private_ip &#61; optional&#40;bool, true&#41;&#10; &#125;&#41;&#41;&#10; psc_config &#61; optional&#40;object&#40;&#123;&#10; allowed_vpcs &#61; optional&#40;list&#40;string&#41;, &#91;&#93;&#41;&#10; &#125;&#41;&#41;&#10; public &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | |
| [oauth_config](variables.tf#L121) | Looker Core Oauth config. Either client ID and secret (existing oauth client) or support email (temporary internal oauth client setup) must be specified. | <code title="object&#40;&#123;&#10; client_id &#61; optional&#40;string, null&#41;&#10; client_secret &#61; optional&#40;string, null&#41;&#10; support_email &#61; optional&#40;string, null&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | |
| [project_id](variables.tf#L154) | The ID of the project where this instances will be created. | <code>string</code> | ✓ | |
| [region](variables.tf#L159) | Region for the Looker core instance. | <code>string</code> | ✓ | |
| [admin_settings](variables.tf#L17) | Looker Core admins settings. | <code title="object&#40;&#123;&#10; allowed_email_domains &#61; list&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [custom_domain](variables.tf#L26) | Looker core instance custom domain. | <code>string</code> | | <code>null</code> |
| [encryption_config](variables.tf#L32) | Set encryption configuration. KMS name format: 'projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]'. | <code title="object&#40;&#123;&#10; kms_key_name &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [maintenance_config](variables.tf#L41) | Set maintenance window configuration and maintenance deny period (up to 90 days). Date format: 'yyyy-mm-dd'. | <code title="object&#40;&#123;&#10; maintenance_window &#61; optional&#40;object&#40;&#123;&#10; day &#61; optional&#40;string, &#34;SUNDAY&#34;&#41;&#10; start_time &#61; optional&#40;object&#40;&#123;&#10; hours &#61; optional&#40;number, 23&#41;&#10; minutes &#61; optional&#40;number, 0&#41;&#10; seconds &#61; optional&#40;number, 0&#41;&#10; nanos &#61; optional&#40;number, 0&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10; &#125;&#41;, null&#41;&#10; deny_maintenance_period &#61; optional&#40;object&#40;&#123;&#10; start_date &#61; object&#40;&#123;&#10; year &#61; number&#10; month &#61; number&#10; day &#61; number&#10; &#125;&#41;&#10; end_date &#61; object&#40;&#123;&#10; year &#61; number&#10; month &#61; number&#10; day &#61; number&#10; &#125;&#41;&#10; start_time &#61; optional&#40;object&#40;&#123;&#10; hours &#61; optional&#40;number, 23&#41;&#10; minutes &#61; optional&#40;number, 0&#41;&#10; seconds &#61; optional&#40;number, 0&#41;&#10; nanos &#61; optional&#40;number, 0&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10; &#125;&#41;, null&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> |
| [platform_edition](variables.tf#L127) | Platform editions for a Looker instance. Each edition maps to a set of instance features, like its size. | <code>string</code> | | <code>&#34;LOOKER_CORE_TRIAL&#34;</code> |
| [prefix](variables.tf#L137) | Optional prefix used to generate instance names. | <code>string</code> | | <code>null</code> |
| [platform_edition](variables.tf#L134) | Platform editions for a Looker instance. Each edition maps to a set of instance features, like its size. | <code>string</code> | | <code>&#34;LOOKER_CORE_TRIAL&#34;</code> |
| [prefix](variables.tf#L144) | Optional prefix used to generate instance names. | <code>string</code> | | <code>null</code> |
## Outputs

View File

@@ -29,6 +29,7 @@ resource "google_looker_instance" "looker" {
platform_edition = var.platform_edition
private_ip_enabled = try(var.network_config.psa_config.enable_private_ip, null)
public_ip_enabled = coalesce(var.network_config.public, false) || try(var.network_config.psa_config.enable_public_ip, false)
psc_enabled = var.network_config.psc_config != null
region = var.region
reserved_range = try(var.network_config.psa_config.allocated_ip_range, null)
@@ -37,6 +38,13 @@ resource "google_looker_instance" "looker" {
client_secret = local.oauth_client_secret
}
dynamic "psc_config" {
for_each = var.network_config.psc_config != null ? [""] : []
content {
allowed_vpcs = var.network_config.psc_config.allowed_vpcs
}
}
dynamic "admin_settings" {
for_each = var.admin_settings != null ? [""] : []
content {

View File

@@ -94,7 +94,7 @@ variable "name" {
}
variable "network_config" {
description = "Network configuration for cluster and instance. Only one between psa_config and psc_config can be used."
description = "Network configuration for cluster and instance. Only one between psa_config, psc_config and public can be used."
type = object({
psa_config = optional(object({
network = string
@@ -102,12 +102,19 @@ variable "network_config" {
enable_public_ip = optional(bool, false)
enable_private_ip = optional(bool, true)
}))
psc_config = optional(object({
allowed_vpcs = optional(list(string), [])
}))
public = optional(bool, false)
})
nullable = false
validation {
condition = (coalesce(var.network_config.public, false)) == (var.network_config.psa_config == null)
error_message = "Please specify either psa_config or public to true."
condition = (
(coalesce(var.network_config.public, false) ? 1 : 0) +
(var.network_config.psa_config != null ? 1 : 0) +
(var.network_config.psc_config != null ? 1 : 0)
) == 1
error_message = "Please specify exactly one of psa_config, psc_config or public."
}
}