Skip to content

Commit

Permalink
google_os_config_os_policy_assignment (GoogleCloudPlatform#5481)
Browse files Browse the repository at this point in the history
* Upgraded DCL and added overrides for osconfig os policy assignment.

Reworked AppendToBasePath override into BasePathReplacement.
Implemented serialization for map[string]string types.

* Split ReplaceInBasePath and AppendToBasePath into two overrides.

* Re-added missing quotation marks.

* Fixed handling of append to base path override.
  • Loading branch information
trodge authored and betsy-lichtenberg committed Apr 25, 2022
1 parent b9344ed commit dd49b41
Show file tree
Hide file tree
Showing 20 changed files with 6,182 additions and 2,674 deletions.
2 changes: 1 addition & 1 deletion mmv1/third_party/terraform/go.mod.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve

require (
cloud.google.com/go/bigtable v1.10.1
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211202000727-18e4bafd7e9b
github.com/apparentlymart/go-cidr v1.1.0
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
Expand Down
6 changes: 2 additions & 4 deletions mmv1/third_party/terraform/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-202110
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211026195335-4a6ae4ac04de/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518 h1:tFdFasG+VDpnn+BfVbZrfGcoH6pw6s7ODYlZlhTO3UM=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef h1:f+09BJVg+I/SObjSguOGGoSQHlT/Y1c8ah+nz1bkppI=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811 h1:j1JJXw1MuANOPXJcruRaKIYIfPMNUwksphKSQruFF6w=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211202000727-18e4bafd7e9b h1:tXwnAInHrxG7UA0ZqJqA6Wh8IFamRpSXZXt/DTZFOyU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211202000727-18e4bafd7e9b/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
2 changes: 1 addition & 1 deletion mmv1/third_party/terraform/utils/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ end # products.each do
"google_monitoring_monitored_project": resourceMonitoringMonitoredProject(),
<% end -%>
"google_org_policy_policy": resourceOrgPolicyPolicy(),
"google_os_config_os_policy_assignment": resourceOSConfigOSPolicyAssignment(),
<% if version == 'private' -%>
"google_os_config_os_policy_assignment": resourceOsConfigOsPolicyAssignment(),
"google_vmware_private_cloud": resourceVmwarePrivateCloud(),
"google_vmware_cluster": resourceVmwareCluster(),
<% end -%>
Expand Down
243 changes: 243 additions & 0 deletions tpgtools/api/osconfig/samples/fixed.os_policy_assignment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
{
"name": "{{assignment}}",
"project": "{{project}}",
"location": "{{zone}}",
"description": "A test os policy assignment",
"osPolicies": [
{
"id": "policy",
"description": "A test os policy",
"mode": "VALIDATION",
"resourceGroups": [
{
"inventoryFilters": [
{
"osShortName": "centos",
"osVersion": "8.*"
}
],
"resources": [
{
"id": "apt",
"pkg": {
"desiredState": "INSTALLED",
"apt": {
"name": "bazel"
}
}
},
{
"id": "deb1",
"pkg": {
"desiredState": "INSTALLED",
"deb": {
"source": {
"localPath": "$HOME/package.deb"
}
}
}
},
{
"id": "deb2",
"pkg": {
"desiredState": "INSTALLED",
"deb": {
"pullDeps": true,
"source": {
"allowInsecure": true,
"remote": {
"uri": "ftp.us.debian.org/debian/package.deb",
"sha256Checksum": "3bbfd1043cd7afdb78cf9afec36c0c5370d2fea98166537b4e67f3816f256025"
}
}
}
}
},
{
"id": "deb3",
"pkg": {
"desiredState": "INSTALLED",
"deb": {
"pullDeps": true,
"source": {
"gcs": {
"bucket": "test-bucket",
"object": "test-object",
"generation": 1
}
}
}
}
},
{
"id": "yum",
"pkg": {
"desiredState": "INSTALLED",
"yum": {
"name": "gstreamer-plugins-base-devel.x86_64"
}
}
},
{
"id": "zypper",
"pkg": {
"desiredState": "INSTALLED",
"zypper": {
"name": "gcc"
}
}
},
{
"id": "rpm1",
"pkg": {
"desiredState": "INSTALLED",
"rpm": {
"pullDeps": true,
"source": {
"localPath": "$HOME/package.rpm"
}
}
}
},
{
"id": "rpm2",
"pkg": {
"desiredState": "INSTALLED",
"rpm": {
"source": {
"allowInsecure": true,
"remote": {
"uri": "https://mirror.jaleco.com/centos/8.3.2011/BaseOS/x86_64/os/Packages/efi-filesystem-3-2.el8.noarch.rpm",
"sha256Checksum": "3bbfd1043cd7afdb78cf9afec36c0c5370d2fea98166537b4e67f3816f256025"
}
}
}
}
},
{
"id": "rpm3",
"pkg": {
"desiredState": "INSTALLED",
"rpm": {
"source": {
"gcs": {
"bucket": "test-bucket",
"object": "test-object",
"generation": 1
}
}
}
}
}
]
},
{
"resources": [
{
"id": "apt-to-deb",
"pkg": {
"desiredState": "INSTALLED",
"apt": {
"name": "bazel"
}
}
},
{
"id": "deb-local-path-to-gcs",
"pkg": {
"desiredState": "INSTALLED",
"deb": {
"source": {
"localPath": "$HOME/package.deb"
}
}
}
},
{
"id": "googet",
"pkg": {
"desiredState": "INSTALLED",
"googet": {
"name": "gcc"
}
}
},
{
"id": "msi1",
"pkg": {
"desiredState": "INSTALLED",
"msi": {
"source": {
"localPath": "$HOME/package.msi"
},
"properties": ["REBOOT=ReallySuppress"]
}
}
},
{
"id": "msi2",
"pkg": {
"desiredState": "INSTALLED",
"msi": {
"source": {
"allowInsecure": true,
"remote": {
"uri": "https://remote.uri.com/package.msi",
"sha256Checksum": "3bbfd1043cd7afdb78cf9afec36c0c5370d2fea98166537b4e67f3816f256025"
},
"sha256Checksum": "3bbfd1043cd7afdb78cf9afec36c0c5370d2fea98166537b4e67f3816f256025"
}
}
}
},
{
"id": "msi3",
"pkg": {
"desiredState": "INSTALLED",
"msi": {
"source": {
"gcs": {
"bucket": "test-bucket",
"object": "test-object",
"generation": 1
}
}
}
}
}
]
}
],
"allowNoResourceGroupMatch": false
}
],
"instanceFilter": {
"all": false,
"inclusionLabels": [
{
"labels": {
"label-one": "value-one"
}
}
],
"exclusionLabels": [
{
"labels": {
"label-two": "value-two"
}
}
],
"inventories": [
{
"osShortName": "centos",
"osVersion": "8.*"
}
]
},
"rollout": {
"disruptionBudget": {
"fixed": 1
},
"minWaitDuration": "3.5s"
}
}
34 changes: 34 additions & 0 deletions tpgtools/api/osconfig/samples/fixed_os_policy_assignment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2021 Google LLC. All Rights Reserved.
#
# 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.
name: fixed_os_policy_assignment
description: An example of an osconfig os policy assignment with fixed rollout disruption
budget
type: os_policy_assignment
versions:
- ga
- beta
- alpha
resource: samples/fixed.os_policy_assignment.json
updates:
- resource: samples/update_fixed.os_policy_assignment.json
dependencies: []
- resource: samples/percent.os_policy_assignment.json
dependencies: []
variables:
- name: assignment
type: resource_name
- name: project
type: project
- name: zone
type: zone
Loading

0 comments on commit dd49b41

Please sign in to comment.