Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into add-networksecurity-urlL…
Browse files Browse the repository at this point in the history
…ists
  • Loading branch information
diogoEsteves42 authored Apr 5, 2023
2 parents ac87bd6 + e06e095 commit 49c4a23
Show file tree
Hide file tree
Showing 28 changed files with 1,243 additions and 81 deletions.
20 changes: 15 additions & 5 deletions mmv1/products/artifactregistry/Repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
vars:
repository_id: "my-repository"
description: "example docker repository"
- !ruby/object:Provider::Terraform::Examples
name: "artifact_registry_repository_docker"
primary_resource_id: "my-repo"
vars:
repository_id: "my-repository"
description: "example docker repository"
- !ruby/object:Provider::Terraform::Examples
name: "artifact_registry_repository_cmek"
primary_resource_id: "my-repo"
Expand All @@ -56,7 +62,6 @@
kms_key_name: 'BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name'
- !ruby/object:Provider::Terraform::Examples
name: "artifact_registry_repository_virtual"
min_version: beta
primary_resource_id: "my-repo"
vars:
repository_id: "my-repository"
Expand All @@ -66,7 +71,6 @@
upstream_policy_id: "my-repository-upstream"
- !ruby/object:Provider::Terraform::Examples
name: "artifact_registry_repository_remote"
min_version: beta
primary_resource_id: "my-repo"
vars:
repository_id: "my-repository"
Expand Down Expand Up @@ -135,6 +139,15 @@
name: updateTime
description: The time when the repository was last updated.
output: true
- !ruby/object:Api::Type::NestedObject
name: 'dockerConfig'
description: |-
Docker repository config contains repository level configuration for the repositories of docker type.
properties:
- !ruby/object:Api::Type::Boolean
name: 'immutableTags'
description: |-
The repository which enabled this flag prevents all tags from being modified, moved or deleted. This does not prevent tags from being created.
- !ruby/object:Api::Type::NestedObject
name: 'mavenConfig'
description: |-
Expand All @@ -161,7 +174,6 @@
default_value: :VERSION_POLICY_UNSPECIFIED
- !ruby/object:Api::Type::Enum
name: 'mode'
min_version: beta
description: |-
The mode configures the repository to serve artifacts from different sources.
immutable: true
Expand All @@ -172,7 +184,6 @@
default_value: :STANDARD_REPOSITORY
- !ruby/object:Api::Type::NestedObject
name: 'virtualRepositoryConfig'
min_version: beta
conflicts:
- remote_repository_config
description: |-
Expand Down Expand Up @@ -200,7 +211,6 @@
Entries with a greater priority value take precedence in the pull order.
- !ruby/object:Api::Type::NestedObject
name: 'remoteRepositoryConfig'
min_version: beta
conflicts:
- virtual_repository_config
description: |-
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/compute/Image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ properties:
- :VIRTIO_SCSI_MULTIQUEUE
- :WINDOWS
- :GVNIC
- :SEV_LIVE_MIGRATABLE
- !ruby/object:Api::Type::Integer
name: 'id'
description: |
Expand Down
6 changes: 2 additions & 4 deletions mmv1/products/dlp/StoredInfoType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ examples:
test_env_vars:
project: :PROJECT_NAME
custom_code: !ruby/object:Provider::Terraform::CustomCode
resource_definition: templates/terraform/resource_definition/dlp_stored_info_type.go.erb
constants: templates/terraform/constants/dlp_stored_info_type.go.erb
decoder: templates/terraform/decoders/dlp_stored_info_type.go.erb
encoder: templates/terraform/encoders/dlp_stored_info_type.go.erb
custom_import: templates/terraform/custom_import/dlp_import.go.erb
Expand Down Expand Up @@ -82,7 +84,6 @@ properties:
- !ruby/object:Api::Type::NestedObject
name: 'regex'
description: Regular expression which defines the rule.
immutable: true
exactly_one_of:
- dictionary
- regex
Expand All @@ -96,14 +97,12 @@ properties:
Its syntax (https://github.com/google/re2/wiki/Syntax) can be found under the google/re2 repository on GitHub.
- !ruby/object:Api::Type::Array
name: 'groupIndexes'
immutable: true
description: |
The index of the submatch to extract as findings. When not specified, the entire match is returned. No more than 3 may be included.
item_type: Api::Type::Integer
- !ruby/object:Api::Type::NestedObject
name: 'dictionary'
description: Dictionary which defines the rule.
immutable: true
exactly_one_of:
- dictionary
- regex
Expand Down Expand Up @@ -139,7 +138,6 @@ properties:
- !ruby/object:Api::Type::NestedObject
name: 'largeCustomDictionary'
description: Dictionary which defines the rule.
immutable: true
exactly_one_of:
- dictionary
- regex
Expand Down
14 changes: 12 additions & 2 deletions mmv1/products/logging/Metric.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

--- !ruby/object:Api::Resource
---
!ruby/object:Api::Resource
name: "Metric"
base_url: projects/{{project}}/metrics
# The % in self_link indicates that the name value should be URL-encoded.
Expand Down Expand Up @@ -51,6 +52,11 @@ examples:
logging_metric_name: "my-(custom)/metric"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "logging_metric_disabled"
primary_resource_id: "logging_metric"
vars:
logging_metric_name: "my-(custom)/metric"
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/self_link_as_name.erb
post_create: templates/terraform/post_create/set_computed_name.erb
Expand All @@ -75,6 +81,10 @@ properties:
description: |
The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects
are supported. The bucket has to be in the same project as the metric.
- !ruby/object:Api::Type::Boolean
name: disabled
description: |
If set to True, then this metric is disabled and it does not generate any points.
- !ruby/object:Api::Type::String
name: filter
description: |
Expand Down Expand Up @@ -155,7 +165,7 @@ properties:
required: false
default_value: :STRING
immutable: true
custom_flatten: 'templates/terraform/custom_flatten/default_if_empty.erb'
custom_flatten: "templates/terraform/custom_flatten/default_if_empty.erb"
- !ruby/object:Api::Type::String
name: displayName
description: |
Expand Down
36 changes: 36 additions & 0 deletions mmv1/templates/terraform/constants/dlp_stored_info_type.go.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%# The license inside this block applies to this file.
# 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.
-%>
func storedInfoTypeCustomizeDiffFunc(diff TerraformResourceDiff) error {
oldDict, newDict := diff.GetChange("dictionary")
oldRegex, newRegex := diff.GetChange("regex")
oldLargeCD, newLargeCD := diff.GetChange("large_custom_dictionary")
if !isEmptyValue(reflect.ValueOf(oldDict)) && isEmptyValue(reflect.ValueOf(newDict)) {
diff.ForceNew("dictionary")
return nil
}
if !isEmptyValue(reflect.ValueOf(oldRegex)) && isEmptyValue(reflect.ValueOf(newRegex)) {
diff.ForceNew("regex")
return nil
}
if !isEmptyValue(reflect.ValueOf(oldLargeCD)) && isEmptyValue(reflect.ValueOf(newLargeCD)) {
diff.ForceNew("large_custom_dictionary")
return nil
}
return nil
}

func storedInfoTypeCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error {
return storedInfoTypeCustomizeDiffFunc(diff)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" {
location = "us-central1"
repository_id = "<%= ctx[:vars]['repository_id'] %>"
description = "<%= ctx[:vars]['description'] %>"
format = "DOCKER"

docker_config {
immutable_tags = true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
location = "us-central1"
repository_id = "<%= ctx[:vars]['repository_id'] %>"
description = "<%= ctx[:vars]['description'] %>"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>-upstream" {
provider = google-beta
location = "us-central1"
repository_id = "<%= ctx[:vars]['upstream_repository_id'] %>"
description = "<%= ctx[:vars]['upstream_description'] %>"
Expand All @@ -8,7 +7,6 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>

resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" {
depends_on = []
provider = google-beta
location = "us-central1"
repository_id = "<%= ctx[:vars]['repository_id'] %>"
description = "<%= ctx[:vars]['description'] %>"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["logging_metric_name"] %>"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor {
metric_kind = "DELTA"
value_type = "INT64"
}
disabled = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%# The license inside this block applies to this file.
# 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.
-%>
CustomizeDiff: storedInfoTypeCustomizeDiff,
Loading

0 comments on commit 49c4a23

Please sign in to comment.