Skip to content

Commit

Permalink
Merge pull request #11126 from c2thorn/sync-main-FEATURE-BRANCH-6.0.0 (
Browse files Browse the repository at this point in the history
…#7700)

Sync main feature branch 6.0.0 - 7/9

[upstream:4271d4af13062044666cb0e4907a2b88d07792a1]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jul 9, 2024
1 parent 42927d0 commit cff59bc
Show file tree
Hide file tree
Showing 76 changed files with 2,757 additions and 984 deletions.
3 changes: 3 additions & 0 deletions .changelog/11126.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
2 changes: 0 additions & 2 deletions google-beta/provider/provider_dcl_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/firebaserules"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gkehub"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/networkconnectivity"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/orgpolicy"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/recaptchaenterprise"
)

Expand Down Expand Up @@ -67,6 +66,5 @@ var dclResources = map[string]*schema.Resource{
"google_gke_hub_feature_membership": gkehub.ResourceGkeHubFeatureMembership(),
"google_network_connectivity_hub": networkconnectivity.ResourceNetworkConnectivityHub(),
"google_network_connectivity_spoke": networkconnectivity.ResourceNetworkConnectivitySpoke(),
"google_org_policy_policy": orgpolicy.ResourceOrgPolicyPolicy(),
"google_recaptcha_enterprise_key": recaptchaenterprise.ResourceRecaptchaEnterpriseKey(),
}
6 changes: 4 additions & 2 deletions google-beta/provider/provider_mmv1_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ var handwrittenDatasources = map[string]*schema.Resource{
"google_dns_managed_zone": dns.DataSourceDnsManagedZone(),
"google_dns_managed_zones": dns.DataSourceDnsManagedZones(),
"google_dns_record_set": dns.DataSourceDnsRecordSet(),
"google_gke_hub_membership_binding": gkehub2.DataSourceGoogleGkeHubMembershipBinding(),
"google_filestore_instance": filestore.DataSourceGoogleFilestoreInstance(),
"google_iam_policy": resourcemanager.DataSourceGoogleIamPolicy(),
"google_iam_role": resourcemanager.DataSourceGoogleIamRole(),
Expand Down Expand Up @@ -468,9 +469,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
}

// Resources
// Generated resources: 489
// Generated resources: 490
// Generated IAM resources: 282
// Total generated resources: 771
// Total generated resources: 772
var generatedResources = map[string]*schema.Resource{
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
Expand Down Expand Up @@ -1085,6 +1086,7 @@ var generatedResources = map[string]*schema.Resource{
"google_notebooks_runtime_iam_member": tpgiamresource.ResourceIamMember(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
"google_notebooks_runtime_iam_policy": tpgiamresource.ResourceIamPolicy(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
"google_org_policy_custom_constraint": orgpolicy.ResourceOrgPolicyCustomConstraint(),
"google_org_policy_policy": orgpolicy.ResourceOrgPolicyPolicy(),
"google_os_config_guest_policies": osconfig.ResourceOSConfigGuestPolicies(),
"google_os_config_patch_deployment": osconfig.ResourceOSConfigPatchDeployment(),
"google_os_login_ssh_public_key": oslogin.ResourceOSLoginSSHPublicKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ resource "google_compute_instance_template" "instance_template" {
}
}
disk {
source_image = "debian-cloud/debian-10"
source_image = "debian-cloud/debian-12"
auto_delete = true
boot = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ resource "google_compute_instance_template" "instance_template" {
}
}
disk {
source_image = "debian-cloud/debian-10"
source_image = "debian-cloud/debian-12"
auto_delete = true
boot = true
}
Expand Down Expand Up @@ -333,7 +333,7 @@ resource "google_compute_instance_template" "instance_template" {
}
}
disk {
source_image = "debian-cloud/debian-10"
source_image = "debian-cloud/debian-12"
auto_delete = true
boot = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ resource "google_compute_instance_template" "instance_template" {
}
}
disk {
source_image = "debian-cloud/debian-10"
source_image = "debian-cloud/debian-12"
auto_delete = true
boot = true
}
Expand Down
16 changes: 0 additions & 16 deletions google-beta/services/bigquery/resource_bigquery_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ access to this encryption key.`,
Optional: true,
Description: `The default partition expiration for all partitioned tables in
the dataset, in milliseconds.
Once this property is set, all newly-created partitioned tables in
the dataset will have an 'expirationMs' property in the 'timePartitioning'
settings set to this value, and changing the value will only
Expand All @@ -160,8 +158,6 @@ over the default partition expiration time indicated by this property.`,
ValidateFunc: validateDefaultTableExpirationMs,
Description: `The default lifetime of all tables in the dataset, in milliseconds.
The minimum value is 3600000 milliseconds (one hour).
Once this property is set, all newly-created tables in the dataset
will have an 'expirationTime' property set to the creation time plus
the value in this property, and changing the value will only affect
Expand Down Expand Up @@ -232,14 +228,10 @@ Please refer to the field 'effective_labels' for all of the labels present on th
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: `The geographic location where the dataset should reside.
See [official docs](https://cloud.google.com/bigquery/docs/dataset-locations).
There are two types of locations, regional or multi-regional. A regional
location is a specific geographic place, such as Tokyo, and a multi-regional
location is a large geographic area, such as the United States, that
contains at least two geographic places.
The default value is multi-regional location 'US'.
Changing this forces a new resource to be created.`,
Default: "US",
Expand Down Expand Up @@ -426,17 +418,9 @@ is 256 characters.`,
Type: schema.TypeString,
Optional: true,
Description: `A special group to grant access to. Possible values include:
* 'projectOwners': Owners of the enclosing project.
* 'projectReaders': Readers of the enclosing project.
* 'projectWriters': Writers of the enclosing project.
* 'allAuthenticatedUsers': All authenticated BigQuery users.`,
},
"user_by_email": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,9 @@ is 256 characters.`,
ForceNew: true,
DiffSuppressFunc: resourceBigQueryDatasetAccessIamMemberDiffSuppress,
Description: `A special group to grant access to. Possible values include:
* 'projectOwners': Owners of the enclosing project.
* 'projectReaders': Readers of the enclosing project.
* 'projectWriters': Writers of the enclosing project.
* 'allAuthenticatedUsers': All authenticated BigQuery users.`,
ExactlyOneOf: []string{"user_by_email", "group_by_email", "domain", "special_group", "iam_member", "view", "dataset", "routine"},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ import (
"github.com/hashicorp/terraform-provider-google-beta/google-beta/verify"
)

// Suppress diffs for the system environment variables
func environmentVariablesDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
if k == "service_config.0.environment_variables.LOG_EXECUTION_ID" && new == "" {
return true
}

// Let diff be determined by environment_variables (above)
if strings.HasPrefix(k, "service_config.0.environment_variables.%") {
return true
}

// For other keys, don't suppress diff.
return false
}

func ResourceCloudfunctions2function() *schema.Resource {
return &schema.Resource{
Create: resourceCloudfunctions2functionCreate,
Expand Down Expand Up @@ -351,10 +366,11 @@ Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
supplied the value is interpreted as bytes.`,
},
"environment_variables": {
Type: schema.TypeMap,
Optional: true,
Description: `Environment variables that shall be available during function execution.`,
Elem: &schema.Schema{Type: schema.TypeString},
Type: schema.TypeMap,
Optional: true,
DiffSuppressFunc: environmentVariablesDiffSuppress,
Description: `Environment variables that shall be available during function execution.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"ingress_settings": {
Type: schema.TypeString,
Expand Down
14 changes: 8 additions & 6 deletions google-beta/services/compute/compute_instance_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ func expandScheduling(v interface{}) (*compute.Scheduling, error) {
scheduling.MaxRunDuration = transformedMaxRunDuration
scheduling.ForceSendFields = append(scheduling.ForceSendFields, "MaxRunDuration")
}
if v, ok := original["maintenance_interval"]; ok {
scheduling.MaintenanceInterval = v.(string)
}

if v, ok := original["on_instance_stop_action"]; ok {
transformedOnInstanceStopAction, err := expandComputeOnInstanceStopAction(v)
Expand All @@ -151,6 +148,9 @@ func expandScheduling(v interface{}) (*compute.Scheduling, error) {
scheduling.OnInstanceStopAction = transformedOnInstanceStopAction
scheduling.ForceSendFields = append(scheduling.ForceSendFields, "OnInstanceStopAction")
}
if v, ok := original["maintenance_interval"]; ok {
scheduling.MaintenanceInterval = v.(string)
}
if v, ok := original["local_ssd_recovery_timeout"]; ok {
transformedLocalSsdRecoveryTimeout, err := expandComputeLocalSsdRecoveryTimeout(v)
if err != nil {
Expand Down Expand Up @@ -263,13 +263,15 @@ func flattenScheduling(resp *compute.Scheduling) []map[string]interface{} {
if resp.MaxRunDuration != nil {
schedulingMap["max_run_duration"] = flattenComputeMaxRunDuration(resp.MaxRunDuration)
}
if resp.MaintenanceInterval != "" {
schedulingMap["maintenance_interval"] = resp.MaintenanceInterval
}

if resp.OnInstanceStopAction != nil {
schedulingMap["on_instance_stop_action"] = flattenOnInstanceStopAction(resp.OnInstanceStopAction)
}

if resp.MaintenanceInterval != "" {
schedulingMap["maintenance_interval"] = resp.MaintenanceInterval
}

if resp.LocalSsdRecoveryTimeout != nil {
schedulingMap["local_ssd_recovery_timeout"] = flattenComputeLocalSsdRecoveryTimeout(resp.LocalSsdRecoveryTimeout)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func TestAccComputeDiskResourcePolicyAttachment_update(t *testing.T) {

diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
policyName := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10))
policyName2 := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10))

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
Expand All @@ -31,7 +30,7 @@ func TestAccComputeDiskResourcePolicyAttachment_update(t *testing.T) {
ImportStateVerify: true,
},
{
Config: testAccComputeDiskResourcePolicyAttachment_basic(diskName, policyName2),
Config: testAccComputeDiskResourcePolicyAttachment_update(diskName, policyName),
},
{
ResourceName: "google_compute_disk_resource_policy_attachment.foobar",
Expand Down Expand Up @@ -82,3 +81,43 @@ resource "google_compute_disk_resource_policy_attachment" "foobar" {
}
`, diskName, policyName)
}

func testAccComputeDiskResourcePolicyAttachment_update(diskName, policyName string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
family = "debian-11"
project = "debian-cloud"
}
resource "google_compute_disk" "foobar" {
name = "%s"
image = data.google_compute_image.my_image.self_link
size = 1000
type = "pd-extreme"
zone = "us-central1-c"
labels = {
my-label = "my-label-value"
}
provisioned_iops = 90000
}
resource "google_compute_resource_policy" "foobar" {
name = "%s"
region = "us-central1"
snapshot_schedule_policy {
schedule {
daily_schedule {
days_in_cycle = 1
start_time = "05:00"
}
}
}
}
resource "google_compute_disk_resource_policy_attachment" "foobar" {
name = google_compute_resource_policy.foobar.name
disk = google_compute_disk.foobar.name
zone = "us-central1-c"
}
`, diskName, policyName)
}
61 changes: 61 additions & 0 deletions google-beta/services/compute/resource_compute_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,36 @@ func TestAccComputeDisk_resourcePolicies(t *testing.T) {
})
}

func TestAccComputeDisk_updateResourcePolicies(t *testing.T) {
t.Parallel()

diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
policyName := fmt.Sprintf("tf-test-policy-%s", acctest.RandString(t, 10))

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccComputeDisk_resourcePolicies(diskName, policyName),
},
{
ResourceName: "google_compute_disk.foobar",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeDisk_updateResourcePolicies(diskName, policyName),
},
{
ResourceName: "google_compute_disk.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccComputeDisk_multiWriter(t *testing.T) {
t.Parallel()
instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
Expand Down Expand Up @@ -1210,6 +1240,37 @@ resource "google_compute_disk" "foobar" {
`, policyName, diskName)
}

func testAccComputeDisk_updateResourcePolicies(diskName, policyName string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
family = "debian-11"
project = "debian-cloud"
}
resource "google_compute_resource_policy" "foo" {
name = "%s"
region = "us-central1"
snapshot_schedule_policy {
schedule {
daily_schedule {
days_in_cycle = 1
start_time = "05:00"
}
}
}
}
resource "google_compute_disk" "foobar" {
name = "%s"
image = data.google_compute_image.my_image.self_link
size = 50
type = "pd-ssd"
zone = "us-central1-a"
resource_policies = [google_compute_resource_policy.foo.self_link]
}
`, policyName, diskName)
}

func testAccComputeDisk_multiWriter(instance string, diskName string, enableMultiwriter bool) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
Expand Down
Loading

0 comments on commit cff59bc

Please sign in to comment.