Skip to content

Commit

Permalink
fix: update terraform for rgv2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thekeys93 committed Oct 30, 2024
1 parent dba7726 commit 4c89e12
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 1,820 deletions.
56 changes: 14 additions & 42 deletions examples/resource_lacework_resource_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,25 @@ terraform {

provider "lacework" {}

resource "lacework_resource_group" "example" {
type = "AWS"
name = var.resource_group_name
description = var.description

group {
operator = "AND"
filter {
filter_name = "filter1"
field = "Region"
operation = "EQUALS"
value = ["us-east-1"]
}

filter {
filter_name = "filter2"
field = "Region"
operation = "EQUALS"
value = ["us-west-2"]
}

resource "lacework_resource_group" "team" {
name = var.resource_group_name
description = var.description
type = "AWS"
group {
operator = "AND"

filter {
filter_name = "filter5"
field = "Region"
operation = "EQUALS"
value = ["us-central-1"]
}

group {
operator = "OR"
operator = "AND"
filter {
filter_name = "filter3"
field = "Account"
operation = "EQUALS"
value = ["987654321"]
filter_name = "account"
field = "Account"
operation = "EQUALS"
value = ["248375806489"]
}
filter {
filter_name = "filter4"
field = "Account"
operation = "EQUALS"
value = ["123456789"]
filter_name = "team_tag"
field = "Resource Tag"
operation = "EQUALS"
value = ["MYTEAM"]
key = "TEAM"
}
}
}
}
}

14 changes: 7 additions & 7 deletions lacework/resource_lacework_resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func resourceLaceworkResourceGroupCreate(d *schema.ResourceData, meta interface{

populateRgQuery(d.Get("group").(*schema.Set), &rgQuery, true)

data := api.NewResourceGroupWithQuery(d.Get("name").(string),
data := api.NewResourceGroup(d.Get("name").(string),
groupType,
d.Get("description").(string),
&rgQuery)
Expand All @@ -260,7 +260,7 @@ func resourceLaceworkResourceGroupCreate(d *schema.ResourceData, meta interface{
}

d.SetId(response.Data.ResourceGroupGuid)
d.Set("name", response.Data.NameV2)
d.Set("name", response.Data.Name)
d.Set("enabled", response.Data.Enabled == 1)
d.Set("query", response.Data.Query)
d.Set("description", response.Data.Description)
Expand Down Expand Up @@ -289,7 +289,7 @@ func resourceLaceworkResourceGroupRead(d *schema.ResourceData, meta interface{})
}

d.SetId(response.Data.ResourceGroupGuid)
d.Set("name", response.Data.NameV2)
d.Set("name", response.Data.Name)
d.Set("enabled", response.Data.Enabled == 1)
d.Set("query", response.Data.Query)
d.Set("description", response.Data.Description)
Expand Down Expand Up @@ -318,7 +318,7 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{

populateRgQuery(d.Get("group").(*schema.Set), &rgQuery, true)

data := api.NewResourceGroupWithQuery(d.Get("name").(string),
data := api.NewResourceGroup(d.Get("name").(string),
groupType,
d.Get("description").(string),
&rgQuery)
Expand All @@ -336,8 +336,8 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{
return err
}

d.SetId(response.Data.ResourceGuid)
d.Set("name", response.Data.NameV2)
d.SetId(response.Data.ResourceGroupGuid)
d.Set("name", response.Data.Name)
d.Set("enabled", response.Data.Enabled == 1)
d.Set("query", response.Data.Query)
d.Set("description", response.Data.Description)
Expand All @@ -346,7 +346,7 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{
d.Set("type", response.Data.Type)

log.Printf("[INFO] Updated %s Resource Group with guid %s\n",
data.Type, response.Data.ResourceGuid)
data.Type, response.Data.ResourceGroupGuid)
return nil
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/lacework/go-sdk/api/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion vendor/github.com/lacework/go-sdk/api/component_data.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions vendor/github.com/lacework/go-sdk/api/feature_flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 2 additions & 14 deletions vendor/github.com/lacework/go-sdk/api/lql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions vendor/github.com/lacework/go-sdk/api/lql_validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions vendor/github.com/lacework/go-sdk/api/policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c89e12

Please sign in to comment.