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

Upgrade DCL to 1.66.0 #18000

Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
cloud.google.com/go/bigtable v1.19.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.66.0
github.com/apparentlymart/go-cidr v1.1.0
github.com/davecgh/go-spew v1.1.1
github.com/dnaeon/go-vcr v1.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cloud.google.com/go/longrunning v0.5.5/go.mod h1:WV2LAxD8/rg5Z1cNW6FJ/ZpX4E4VnDn
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.0 h1:QA90iKudX8ijAW795f/jVbo0oEo7VoevwxLCNyi2qRc=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.66.0 h1:9C++tMcDcwgT8QTaq2bRtuAB5Tg4o4I4CkDQD57i914=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.66.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ResourceClouddeployDeliveryPipeline() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Name of the `DeliveryPipeline`. Format is [a-z][a-z0-9\\-]{0,62}.",
Description: "Name of the `DeliveryPipeline`. Format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.",
},

"description": {
Expand Down
65 changes: 60 additions & 5 deletions google/services/clouddeploy/resource_clouddeploy_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ResourceClouddeployTarget() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Name of the `Target`. Format is [a-z][a-z0-9\\-]{0,62}.",
Description: "Name of the `Target`. Format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.",
},

"anthos_cluster": {
Expand All @@ -78,7 +78,16 @@ func ResourceClouddeployTarget() *schema.Resource {
Description: "Information specifying an Anthos Cluster.",
MaxItems: 1,
Elem: ClouddeployTargetAnthosClusterSchema(),
ConflictsWith: []string{"gke", "run", "multi_target"},
ConflictsWith: []string{"gke", "run", "multi_target", "custom_target"},
},

"custom_target": {
Type: schema.TypeList,
Optional: true,
Description: "Optional. Information specifying a Custom Target.",
MaxItems: 1,
Elem: ClouddeployTargetCustomTargetSchema(),
ConflictsWith: []string{"gke", "anthos_cluster", "run", "multi_target"},
},

"deploy_parameters": {
Expand Down Expand Up @@ -120,7 +129,7 @@ func ResourceClouddeployTarget() *schema.Resource {
Description: "Information specifying a GKE Cluster.",
MaxItems: 1,
Elem: ClouddeployTargetGkeSchema(),
ConflictsWith: []string{"anthos_cluster", "run", "multi_target"},
ConflictsWith: []string{"anthos_cluster", "run", "multi_target", "custom_target"},
},

"multi_target": {
Expand All @@ -129,7 +138,7 @@ func ResourceClouddeployTarget() *schema.Resource {
Description: "Information specifying a multiTarget.",
MaxItems: 1,
Elem: ClouddeployTargetMultiTargetSchema(),
ConflictsWith: []string{"gke", "anthos_cluster", "run"},
ConflictsWith: []string{"gke", "anthos_cluster", "run", "custom_target"},
},

"project": {
Expand All @@ -153,7 +162,7 @@ func ResourceClouddeployTarget() *schema.Resource {
Description: "Information specifying a Cloud Run deployment target.",
MaxItems: 1,
Elem: ClouddeployTargetRunSchema(),
ConflictsWith: []string{"gke", "anthos_cluster", "multi_target"},
ConflictsWith: []string{"gke", "anthos_cluster", "multi_target", "custom_target"},
},

"annotations": {
Expand Down Expand Up @@ -222,6 +231,19 @@ func ClouddeployTargetAnthosClusterSchema() *schema.Resource {
}
}

func ClouddeployTargetCustomTargetSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"custom_target_type": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
Description: "Required. The name of the CustomTargetType. Format must be `projects/{project}/locations/{location}/customTargetTypes/{custom_target_type}`.",
},
},
}
}

func ClouddeployTargetExecutionConfigsSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -318,6 +340,7 @@ func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) e
Location: dcl.String(d.Get("location").(string)),
Name: dcl.String(d.Get("name").(string)),
AnthosCluster: expandClouddeployTargetAnthosCluster(d.Get("anthos_cluster")),
CustomTarget: expandClouddeployTargetCustomTarget(d.Get("custom_target")),
DeployParameters: tpgresource.CheckStringMap(d.Get("deploy_parameters")),
Description: dcl.String(d.Get("description").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("effective_annotations")),
Expand Down Expand Up @@ -378,6 +401,7 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
Location: dcl.String(d.Get("location").(string)),
Name: dcl.String(d.Get("name").(string)),
AnthosCluster: expandClouddeployTargetAnthosCluster(d.Get("anthos_cluster")),
CustomTarget: expandClouddeployTargetCustomTarget(d.Get("custom_target")),
DeployParameters: tpgresource.CheckStringMap(d.Get("deploy_parameters")),
Description: dcl.String(d.Get("description").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("effective_annotations")),
Expand Down Expand Up @@ -421,6 +445,9 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
if err = d.Set("anthos_cluster", flattenClouddeployTargetAnthosCluster(res.AnthosCluster)); err != nil {
return fmt.Errorf("error setting anthos_cluster in state: %s", err)
}
if err = d.Set("custom_target", flattenClouddeployTargetCustomTarget(res.CustomTarget)); err != nil {
return fmt.Errorf("error setting custom_target in state: %s", err)
}
if err = d.Set("deploy_parameters", res.DeployParameters); err != nil {
return fmt.Errorf("error setting deploy_parameters in state: %s", err)
}
Expand Down Expand Up @@ -489,6 +516,7 @@ func resourceClouddeployTargetUpdate(d *schema.ResourceData, meta interface{}) e
Location: dcl.String(d.Get("location").(string)),
Name: dcl.String(d.Get("name").(string)),
AnthosCluster: expandClouddeployTargetAnthosCluster(d.Get("anthos_cluster")),
CustomTarget: expandClouddeployTargetCustomTarget(d.Get("custom_target")),
DeployParameters: tpgresource.CheckStringMap(d.Get("deploy_parameters")),
Description: dcl.String(d.Get("description").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("effective_annotations")),
Expand Down Expand Up @@ -544,6 +572,7 @@ func resourceClouddeployTargetDelete(d *schema.ResourceData, meta interface{}) e
Location: dcl.String(d.Get("location").(string)),
Name: dcl.String(d.Get("name").(string)),
AnthosCluster: expandClouddeployTargetAnthosCluster(d.Get("anthos_cluster")),
CustomTarget: expandClouddeployTargetCustomTarget(d.Get("custom_target")),
DeployParameters: tpgresource.CheckStringMap(d.Get("deploy_parameters")),
Description: dcl.String(d.Get("description").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("effective_annotations")),
Expand Down Expand Up @@ -626,6 +655,32 @@ func flattenClouddeployTargetAnthosCluster(obj *clouddeploy.TargetAnthosCluster)

return []interface{}{transformed}

}

func expandClouddeployTargetCustomTarget(o interface{}) *clouddeploy.TargetCustomTarget {
if o == nil {
return clouddeploy.EmptyTargetCustomTarget
}
objArr := o.([]interface{})
if len(objArr) == 0 || objArr[0] == nil {
return clouddeploy.EmptyTargetCustomTarget
}
obj := objArr[0].(map[string]interface{})
return &clouddeploy.TargetCustomTarget{
CustomTargetType: dcl.String(obj["custom_target_type"].(string)),
}
}

func flattenClouddeployTargetCustomTarget(obj *clouddeploy.TargetCustomTarget) interface{} {
if obj == nil || obj.Empty() {
return nil
}
transformed := map[string]interface{}{
"custom_target_type": obj.CustomTargetType,
}

return []interface{}{transformed}

}
func expandClouddeployTargetExecutionConfigsArray(o interface{}) []clouddeploy.TargetExecutionConfigs {
if o == nil {
Expand Down
28 changes: 27 additions & 1 deletion google/services/compute/resource_compute_firewall_policy_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func ResourceComputeFirewallPolicyRule() *schema.Resource {
"action": {
Type: schema.TypeString,
Required: true,
Description: "The Action to perform when the client connection triggers the rule. Valid actions are \"allow\", \"deny\" and \"goto_next\".",
Description: "The Action to perform when the client connection triggers the rule. Valid actions are \"allow\", \"deny\", \"goto_next\" and \"apply_security_profile_group\".",
},

"direction": {
Expand Down Expand Up @@ -109,6 +109,12 @@ func ResourceComputeFirewallPolicyRule() *schema.Resource {
Description: "Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on \"goto_next\" rules.",
},

"security_profile_group": {
Type: schema.TypeString,
Optional: true,
Description: "A fully-qualified URL of a SecurityProfileGroup resource. Example: https://networksecurity.googleapis.com/v1/organizations/{organizationId}/locations/global/securityProfileGroups/my-security-profile-group. It must be specified if action = 'apply_security_profile_group' and cannot be specified for other actions.",
},

"target_resources": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -124,6 +130,12 @@ func ResourceComputeFirewallPolicyRule() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},

"tls_inspect": {
Type: schema.TypeBool,
Optional: true,
Description: "Boolean flag indicating if the traffic should be TLS decrypted. It can be set only if action = 'apply_security_profile_group' and cannot be set for other actions.",
},

"kind": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -253,8 +265,10 @@ func resourceComputeFirewallPolicyRuleCreate(d *schema.ResourceData, meta interf
Description: dcl.String(d.Get("description").(string)),
Disabled: dcl.Bool(d.Get("disabled").(bool)),
EnableLogging: dcl.Bool(d.Get("enable_logging").(bool)),
SecurityProfileGroup: dcl.String(d.Get("security_profile_group").(string)),
TargetResources: tpgdclresource.ExpandStringArray(d.Get("target_resources")),
TargetServiceAccounts: tpgdclresource.ExpandStringArray(d.Get("target_service_accounts")),
TlsInspect: dcl.Bool(d.Get("tls_inspect").(bool)),
}

id, err := obj.ID()
Expand Down Expand Up @@ -306,8 +320,10 @@ func resourceComputeFirewallPolicyRuleRead(d *schema.ResourceData, meta interfac
Description: dcl.String(d.Get("description").(string)),
Disabled: dcl.Bool(d.Get("disabled").(bool)),
EnableLogging: dcl.Bool(d.Get("enable_logging").(bool)),
SecurityProfileGroup: dcl.String(d.Get("security_profile_group").(string)),
TargetResources: tpgdclresource.ExpandStringArray(d.Get("target_resources")),
TargetServiceAccounts: tpgdclresource.ExpandStringArray(d.Get("target_service_accounts")),
TlsInspect: dcl.Bool(d.Get("tls_inspect").(bool)),
}

userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
Expand Down Expand Up @@ -356,12 +372,18 @@ func resourceComputeFirewallPolicyRuleRead(d *schema.ResourceData, meta interfac
if err = d.Set("enable_logging", res.EnableLogging); err != nil {
return fmt.Errorf("error setting enable_logging in state: %s", err)
}
if err = d.Set("security_profile_group", res.SecurityProfileGroup); err != nil {
return fmt.Errorf("error setting security_profile_group in state: %s", err)
}
if err = d.Set("target_resources", res.TargetResources); err != nil {
return fmt.Errorf("error setting target_resources in state: %s", err)
}
if err = d.Set("target_service_accounts", res.TargetServiceAccounts); err != nil {
return fmt.Errorf("error setting target_service_accounts in state: %s", err)
}
if err = d.Set("tls_inspect", res.TlsInspect); err != nil {
return fmt.Errorf("error setting tls_inspect in state: %s", err)
}
if err = d.Set("kind", res.Kind); err != nil {
return fmt.Errorf("error setting kind in state: %s", err)
}
Expand All @@ -383,8 +405,10 @@ func resourceComputeFirewallPolicyRuleUpdate(d *schema.ResourceData, meta interf
Description: dcl.String(d.Get("description").(string)),
Disabled: dcl.Bool(d.Get("disabled").(bool)),
EnableLogging: dcl.Bool(d.Get("enable_logging").(bool)),
SecurityProfileGroup: dcl.String(d.Get("security_profile_group").(string)),
TargetResources: tpgdclresource.ExpandStringArray(d.Get("target_resources")),
TargetServiceAccounts: tpgdclresource.ExpandStringArray(d.Get("target_service_accounts")),
TlsInspect: dcl.Bool(d.Get("tls_inspect").(bool)),
}
directive := tpgdclresource.UpdateDirective
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
Expand Down Expand Up @@ -431,8 +455,10 @@ func resourceComputeFirewallPolicyRuleDelete(d *schema.ResourceData, meta interf
Description: dcl.String(d.Get("description").(string)),
Disabled: dcl.Bool(d.Get("disabled").(bool)),
EnableLogging: dcl.Bool(d.Get("enable_logging").(bool)),
SecurityProfileGroup: dcl.String(d.Get("security_profile_group").(string)),
TargetResources: tpgdclresource.ExpandStringArray(d.Get("target_resources")),
TargetServiceAccounts: tpgdclresource.ExpandStringArray(d.Get("target_service_accounts")),
TlsInspect: dcl.Bool(d.Get("tls_inspect").(bool)),
}

log.Printf("[DEBUG] Deleting FirewallPolicyRule %q", d.Id())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ func testAccCheckComputeFirewallPolicyRuleDestroyProducer(t *testing.T) func(s *
}

obj := &compute.FirewallPolicyRule{
Action: dcl.String(rs.Primary.Attributes["action"]),
Direction: compute.FirewallPolicyRuleDirectionEnumRef(rs.Primary.Attributes["direction"]),
FirewallPolicy: dcl.String(rs.Primary.Attributes["firewall_policy"]),
Description: dcl.String(rs.Primary.Attributes["description"]),
Disabled: dcl.Bool(rs.Primary.Attributes["disabled"] == "true"),
EnableLogging: dcl.Bool(rs.Primary.Attributes["enable_logging"] == "true"),
Kind: dcl.StringOrNil(rs.Primary.Attributes["kind"]),
Action: dcl.String(rs.Primary.Attributes["action"]),
Direction: compute.FirewallPolicyRuleDirectionEnumRef(rs.Primary.Attributes["direction"]),
FirewallPolicy: dcl.String(rs.Primary.Attributes["firewall_policy"]),
Description: dcl.String(rs.Primary.Attributes["description"]),
Disabled: dcl.Bool(rs.Primary.Attributes["disabled"] == "true"),
EnableLogging: dcl.Bool(rs.Primary.Attributes["enable_logging"] == "true"),
SecurityProfileGroup: dcl.String(rs.Primary.Attributes["security_profile_group"]),
TlsInspect: dcl.Bool(rs.Primary.Attributes["tls_inspect"] == "true"),
Kind: dcl.StringOrNil(rs.Primary.Attributes["kind"]),
}

client := transport_tpg.NewDCLComputeClient(config, config.UserAgent, billingProject, 0)
Expand Down
Loading