Skip to content

Commit d5a4e4a

Browse files
Adds support for public access prevention (beta) (#5519) (#10740)
Signed-off-by: Modular Magician <[email protected]>
1 parent 764aca2 commit d5a4e4a

File tree

4 files changed

+53
-42
lines changed

4 files changed

+53
-42
lines changed

.changelog/5519.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: added field `public_access_prevention` to resource `bucket` (beta)
3+
```

google/resource_storage_bucket.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,6 @@ func resourceStorageBucketUpdate(d *schema.ResourceData, meta interface{}) error
589589
}
590590

591591
res, err := config.NewStorageClient(userAgent).Buckets.Patch(d.Get("name").(string), sb).Do()
592-
593592
if err != nil {
594593
return err
595594
}
@@ -735,6 +734,12 @@ func resourceStorageBucketRead(d *schema.ResourceData, meta interface{}) error {
735734
}
736735
}
737736

737+
if res.IamConfiguration != nil && res.IamConfiguration.PublicAccessPrevention != "" {
738+
if err := d.Set("public_access_prevention", res.IamConfiguration.PublicAccessPrevention); err != nil {
739+
return fmt.Errorf("Error setting public_access_prevention: %s", err)
740+
}
741+
}
742+
738743
if res.Billing == nil {
739744
if err := d.Set("requester_pays", nil); err != nil {
740745
return fmt.Errorf("Error setting requester_pays: %s", err)
@@ -1119,13 +1124,15 @@ func expandBucketWebsite(v interface{}) *storage.BucketWebsite {
11191124
}
11201125

11211126
func expandIamConfiguration(d *schema.ResourceData) *storage.BucketIamConfiguration {
1122-
return &storage.BucketIamConfiguration{
1127+
cfg := &storage.BucketIamConfiguration{
11231128
ForceSendFields: []string{"UniformBucketLevelAccess"},
11241129
UniformBucketLevelAccess: &storage.BucketIamConfigurationUniformBucketLevelAccess{
11251130
Enabled: d.Get("uniform_bucket_level_access").(bool),
11261131
ForceSendFields: []string{"Enabled"},
11271132
},
11281133
}
1134+
1135+
return cfg
11291136
}
11301137

11311138
func expandStorageBucketLifecycle(v interface{}) (*storage.BucketLifecycle, error) {

google/resource_storage_bucket_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ func TestAccStorageBucket_forceDestroyObjectDeleteError(t *testing.T) {
590590
},
591591
})
592592
}
593+
593594
func TestAccStorageBucket_versioning(t *testing.T) {
594595
t.Parallel()
595596

website/docs/r/os_config_os_policy_assignment.html.markdown

+40-40
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,46 @@ The `disruption_budget` block supports:
703703
(Optional)
704704
Specifies the relative value defined as a percentage, which will be multiplied by a reference value.
705705

706+
The `source` block supports:
707+
708+
* `allow_insecure` -
709+
(Optional)
710+
Defaults to false. When false, files are subject to validations based on the file type: Remote: A checksum must be specified. Cloud Storage: An object generation number must be specified.
711+
712+
* `gcs` -
713+
(Optional)
714+
A Cloud Storage object.
715+
716+
* `local_path` -
717+
(Optional)
718+
A local path within the VM to use.
719+
720+
* `remote` -
721+
(Optional)
722+
A generic remote file.
723+
724+
The `validate` block supports:
725+
726+
* `interpreter` -
727+
(Required)
728+
Required. The script interpreter to use. Possible values: INTERPRETER_UNSPECIFIED, NONE, SHELL, POWERSHELL
729+
730+
* `args` -
731+
(Optional)
732+
Optional arguments to pass to the source during execution.
733+
734+
* `file` -
735+
(Optional)
736+
Required. A deb package.
737+
738+
* `output_file_path` -
739+
(Optional)
740+
Only recorded for enforce Exec. Path to an output file (that is created by this Exec) whose content will be recorded in OSPolicyResourceCompliance after a successful run. Absence or failure to read this file will result in this ExecResource being non-compliant. Output file size is limited to 100K bytes.
741+
742+
* `script` -
743+
(Optional)
744+
An inline script. The size of the script is limited to 1024 characters.
745+
706746
- - -
707747

708748
* `description` -
@@ -952,24 +992,6 @@ The `zypper` block supports:
952992
(Required)
953993
Required. A one word, unique name for this repository. This is the `repo id` in the zypper config file and also the `display_name` if `display_name` is omitted. This id is also used as the unique identifier when checking for GuestPolicy conflicts.
954994

955-
The `file` block supports:
956-
957-
* `allow_insecure` -
958-
(Optional)
959-
Defaults to false. When false, files are subject to validations based on the file type: Remote: A checksum must be specified. Cloud Storage: An object generation number must be specified.
960-
961-
* `gcs` -
962-
(Optional)
963-
A Cloud Storage object.
964-
965-
* `local_path` -
966-
(Optional)
967-
A local path within the VM to use.
968-
969-
* `remote` -
970-
(Optional)
971-
A generic remote file.
972-
973995
The `gcs` block supports:
974996

975997
* `bucket` -
@@ -994,28 +1016,6 @@ The `remote` block supports:
9941016
(Optional)
9951017
SHA256 checksum of the remote file.
9961018

997-
The `enforce` block supports:
998-
999-
* `interpreter` -
1000-
(Required)
1001-
Required. The script interpreter to use. Possible values: INTERPRETER_UNSPECIFIED, NONE, SHELL, POWERSHELL
1002-
1003-
* `args` -
1004-
(Optional)
1005-
Optional arguments to pass to the source during execution.
1006-
1007-
* `file` -
1008-
(Optional)
1009-
Required. A deb package.
1010-
1011-
* `output_file_path` -
1012-
(Optional)
1013-
Only recorded for enforce Exec. Path to an output file (that is created by this Exec) whose content will be recorded in OSPolicyResourceCompliance after a successful run. Absence or failure to read this file will result in this ExecResource being non-compliant. Output file size is limited to 100K bytes.
1014-
1015-
* `script` -
1016-
(Optional)
1017-
An inline script. The size of the script is limited to 1024 characters.
1018-
10191019
## Attributes Reference
10201020

10211021
In addition to the arguments listed above, the following computed attributes are exported:

0 commit comments

Comments
 (0)