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
Changes from all commits
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
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,
ValidateFunc: validation.StringInSlice([]string{"CLOUD_ARMOR", "CLOUD_ARMOR_EDGE"}, false),
ForceNew: true,
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