Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow zone and location to be required toplevel properties #12953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mmv1/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ func (r *Resource) Validate() {

for _, property := range r.AllProperties() {
property.Validate(r.Name)
if (property.Name == "zone" || property.Name == "location") && property.Required {
log.Fatalf("Property %s in resource %s cannot be marked as required to preserve provider-level defaults", property.Name, r.Name)
}
}

if r.IamPolicy != nil {
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/alloydb/Backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ parameters:
description: |
The location where the alloydb backup should reside.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/alloydb/Cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ parameters:
description: |
The location where the alloydb cluster should reside.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/apigee/EndpointAttachment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ properties:
type: String
description: |
Location of the endpoint attachment.
required: true
- name: 'host'
type: String
description: |
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/apigee/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ properties:
type: String
description: |
Required. Compute Engine location where the instance resides.
required: true
immutable: true
- name: 'peeringCidrRange'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/apphub/Application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ parameters:
type: String
description: 'Part of `parent`. See documentation of `projectsId`.'
url_param_only: true
required: true
immutable: true
- name: 'applicationId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/apphub/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ parameters:
type: String
description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}'
url_param_only: true
required: true
immutable: true
- name: 'applicationId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/apphub/Workload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ parameters:
type: String
description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}'
url_param_only: true
required: true
immutable: true
- name: 'applicationId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/backupdr/BackupPlan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ examples:
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: |
The location for the backup plan
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/backupdr/BackupPlanAssociation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ examples:
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: |
The location for the backupplan association
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/backupdr/BackupVault.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ parameters:
type: String
description: "The GCP location for the backup vault. "
url_param_only: true
required: true
immutable: true
- name: 'backupVaultId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/backupdr/ManagementServer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ parameters:
The location for the management server (management console)
min_version: 'beta'
url_param_only: true
required: true
- name: 'name'
type: String
description: |-
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/biglake/Catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ parameters:
description: |
The geographic location where the Catalog should reside.
url_param_only: true
required: true
immutable: true
- name: 'name'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/bigqueryanalyticshub/DataExchange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ properties:
description: |
The name of the location this data exchange.
url_param_only: true
required: true
immutable: true
- name: 'displayName'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/bigqueryanalyticshub/Listing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ properties:
description: |
The name of the location this data exchange listing.
url_param_only: true
required: true
immutable: true
- name: 'displayName'
type: String
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/bigqueryanalyticshub/ListingSubscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ parameters:
description: |
The name of the location for this subscription.
url_param_only: true
required: true
custom_flatten: 'templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl'
diff_suppress_func: 'tpgresource.CaseDiffSuppress'
properties:
Expand All @@ -75,7 +74,6 @@ properties:
description: |
The geographic location where the dataset should reside.
See https://cloud.google.com/bigquery/docs/locations for supported locations.
required: true
custom_flatten: 'templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl'
diff_suppress_func: 'tpgresource.CaseDiffSuppress'
- name: 'datasetReference'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/bigquerydatapolicy/DataPolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ properties:
description: |
The name of the location of the data policy.
url_param_only: true
required: true
immutable: true
- name: 'policyTag'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/bigqueryreservation/BiReservation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ parameters:
description: |
LOCATION_DESCRIPTION
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/blockchainnodeengine/BlockchainNodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ parameters:
description: |
Location of Blockchain Node being created.
url_param_only: true
required: true
immutable: true
- name: 'blockchainNodeId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/certificatemanager/TrustConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ parameters:
description: |
The trust config location.
url_param_only: true
required: true
immutable: true
properties:
- name: 'createTime'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudbuild/BitbucketServerConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ parameters:
description: |
The location of this bitbucket server config.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudbuildv2/Connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ parameters:
type: String
description: The location for the resource
url_param_only: true
required: true
immutable: true
properties:
- name: 'createTime'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/clouddeploy/Automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ parameters:
type: String
description: "The location for the resource"
url_param_only: true
required: true
immutable: true
- name: 'delivery_pipeline'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/clouddeploy/CustomTargetType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ parameters:
type: String
description: "The location of the source."
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/clouddomains/Registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ parameters:
type: String
description: "The location for the resource"
url_param_only: true
required: true
- name: 'domainName'
type: String
description: "Required. The domain name. Unicode domain names must be expressed in Punycode format."
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudfunctions2/Function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ parameters:
type: String
description: The location of this cloud function.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudids/Endpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ parameters:
description: |
The location for the endpoint.
url_param_only: true
required: true
immutable: true
ignore_read: true
properties:
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudrun/DomainMapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ parameters:
type: String
description: The location of the cloud run instance. eg us-central1
url_param_only: true
required: true
properties:
- name: 'name'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudrun/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ parameters:
type: String
description: The location of the cloud run instance. eg us-central1
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudrunv2/Job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ parameters:
type: String
description: The location of the cloud run job
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudrunv2/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ parameters:
type: String
description: The location of the cloud run service
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/cloudtasks/Queue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ parameters:
type: String
description: The location of the queue
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/colab/NotebookExecution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ examples:
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: 'The location for the resource: https://cloud.google.com/colab/docs/locations'
- name: 'notebookExecutionJobId'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/colab/Runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ virtual_fields:
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: 'The location for the resource: https://cloud.google.com/colab/docs/locations'
immutable: true
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/colab/RuntimeTemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ examples:
parameters:
- name: 'location'
type: String
required: true
url_param_only: true
description: 'The location for the resource: https://cloud.google.com/colab/docs/locations'
properties:
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/DiskType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ parameters:
- name: 'zone'
type: ResourceRef
description: 'A reference to the zone where the disk type resides.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ parameters:
- name: 'zone'
type: ResourceRef
description: 'A reference to the zone where the machine resides.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/InstanceGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ parameters:
- name: 'zone'
type: ResourceRef
description: 'A reference to the zone where the instance group resides.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/InstanceGroupManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ parameters:
- name: 'zone'
type: ResourceRef
description: 'The zone the managed instance group resides.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/InstanceSettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ parameters:
- name: 'zone'
type: ResourceRef
description: 'A reference to the zone where the machine resides.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/MachineType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ properties:
- name: 'zone'
type: ResourceRef
description: 'The zone the machine type is defined.'
required: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
imports: 'name'
1 change: 0 additions & 1 deletion mmv1/products/compute/Reservation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ parameters:
type: ResourceRef
description: |
The zone where the reservation is made.
required: true
immutable: true
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
resource: 'Zone'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/compute/ResizeRequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ parameters:
description: |
The reference of the compute zone scoping this request.
url_param_only: true
required: true
resource: 'Zone'
imports: 'name'
- name: 'instanceGroupManager'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/containerattached/Cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ properties:
description: |
The location for the resource
url_param_only: true
required: true
immutable: true
- name: 'name'
type: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ parameters:
description: |
The name of the location this private connection is located in.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/dataplex/Datascan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ parameters:
description: |
The location where the data scan should reside.
url_param_only: true
required: true
immutable: true
- name: 'dataScanId'
type: String
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/datastream/ConnectionProfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ parameters:
description: |
The name of the location this connection profile is located in.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/datastream/PrivateConnection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ parameters:
description: |
The name of the location this private connection is located in.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
Expand Down
Loading
Loading