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

feat: add type to security policy #10764

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module github.com/hashicorp/terraform-provider-google
jasondamour marked this conversation as resolved.
Show resolved Hide resolved

require (
cloud.google.com/go/bigtable v1.10.1
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211215020606-79616333f950
Expand All @@ -9,7 +10,7 @@ require (
github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect
github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92
github.com/golangci/golangci-lint v1.40.1
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
jasondamour marked this conversation as resolved.
Show resolved Hide resolved
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-multierror v1.1.1
Expand All @@ -19,7 +20,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.1.0
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/afero v1.2.2 // indirect
github.com/zclconf/go-cty v1.5.1 // indirect
golang.org/x/mod v0.5.0 // indirect
Expand Down
11 changes: 11 additions & 0 deletions google/resource_compute_security_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ func resourceComputeSecurityPolicy() *schema.Resource {
Description: `The project in which the resource belongs. If it is not provided, the provider project is used.`,
},

"type": {
jasondamour marked this conversation as resolved.
Show resolved Hide resolved
Type: schema.TypeString,
Optional: true,
ForceNew: true,
jasondamour marked this conversation as resolved.
Show resolved Hide resolved
Default: "CLOUD_ARMOR",
jasondamour marked this conversation as resolved.
Show resolved Hide resolved
Description: `The type indicates the intended use of the security policy. CLOUD_ARMOR - Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. CLOUD_ARMOR_EDGE - Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache.`,
},

"rule": {
Type: schema.TypeSet,
Optional: true,
Expand Down Expand Up @@ -256,6 +264,9 @@ func resourceComputeSecurityPolicyRead(d *schema.ResourceData, meta interface{})
if err := d.Set("name", securityPolicy.Name); err != nil {
return fmt.Errorf("Error setting name: %s", err)
}
if err := d.Set("type", securityPolicy.Type); err != nil {
return fmt.Errorf("Error setting type: %s", err)

if err := d.Set("description", securityPolicy.Description); err != nil {
return fmt.Errorf("Error setting description: %s", err)
}
Expand Down