Skip to content

Commit

Permalink
chore: Fix the RGv2 bugs (#663)
Browse files Browse the repository at this point in the history
* chore: Upgrade the go version number

Signed-off-by: Lei Jin <lei.jin@lacework.net>

* feat: Sync with RG changes on go sdk

* chore: Update RG docs

* chore: cleanup stale references

* fix terraform apply

* chore: disabling failed tests

Signed-off-by: Lei Jin <lei.jin@lacework.net>

---------

Signed-off-by: Lei Jin <lei.jin@lacework.net>
Co-authored-by: Zeki Sherif <zeki.sherif@lacework.net>
  • Loading branch information
leijin-lw and zekisherif authored Oct 31, 2024
1 parent ad9e88e commit 79b6808
Show file tree
Hide file tree
Showing 28 changed files with 510 additions and 2,172 deletions.
4 changes: 2 additions & 2 deletions docs/resources/resource_group.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
subcategory: "Resource Groups"
layout: "lacework"
page_title: "Lacework: (beta) lacework_resource_group"
page_title: "Lacework: lacework_resource_group"
description: |-
Create and manage Resource Groups in Lacework
---
Expand Down Expand Up @@ -74,7 +74,7 @@ The following arguments are supported:
* `name` - (Required) The resource group name.
* `group` - (Required) The representation of the expression that a resource must match to be
part of the resource group. Groups can be nested up to 3 levels deep and can be combined by
individual filters. See the [api-docs](https://lwdocs-rg2.netlify.app/api/api-resource-group/#filterable-fields) for the supported fields.
individual filters. See the [api-docs](https://docs.fortinet.com/document/lacework-forticnapp/latest/api-reference/690087/using-the-resource-groups-api#filterable-fields) for the supported fields.
Each `group` must have at least one of `group` or `filter` defined.
* `type` - (Required) The type of resource group being created, AWS, GCP, or AZURE
* `description` - (Optional) The description of the resource group.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/gruntwork-io/terratest v0.46.15
github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0
github.com/lacework/go-sdk v1.49.0
github.com/lacework/go-sdk v1.54.1-0.20241030155210-2b0ffd411c65
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
golang.org/x/text v0.14.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lacework/go-sdk v1.49.0 h1:SgjQ5eudkSPHTzAquWLaJZKo8qRgEXOdqL+Tnw+cVMI=
github.com/lacework/go-sdk v1.49.0/go.mod h1:l0kCskNExDs1E8fBfpaZeafC42pmKucdXn3nZO1iyLI=
github.com/lacework/go-sdk v1.54.1-0.20241030155210-2b0ffd411c65 h1:A4LDKoyuC0fKknf7Nd6BM3MkFqzlbmjs0gXDPsH5szQ=
github.com/lacework/go-sdk v1.54.1-0.20241030155210-2b0ffd411c65/go.mod h1:l0kCskNExDs1E8fBfpaZeafC42pmKucdXn3nZO1iyLI=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
Expand Down
66 changes: 0 additions & 66 deletions integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,50 +295,6 @@ func GetResourceGroupV2Description(result string) string {
return response.Data.Description
}

func GetResourceGroupDescription(result string) string {
id := GetIDFromTerraResults(result)

response, err := LwClient.V2.ResourceGroups.GetAws(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props.Description
}

func GetAzureResourceGroupProps(result string) api.AzureResourceGroupProps {
id := GetIDFromTerraResults(result)

response, err := LwClient.V2.ResourceGroups.GetAzure(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props
}

func GetGcpResourceGroupProps(result string) api.GcpResourceGroupProps {
id := GetIDFromTerraResults(result)

response, err := LwClient.V2.ResourceGroups.GetGcp(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props
}

func GetContainerResourceGroupProps(result string) api.ContainerResourceGroupProps {
id := GetIDFromTerraResults(result)

response, err := LwClient.V2.ResourceGroups.GetContainer(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props
}

func GetTeamMember(result string) api.TeamMember {
id := GetIDFromTerraResults(result)

Expand All @@ -363,28 +319,6 @@ func GetOrgTeamMember(result string) api.TeamMember {
return res.Data
}

func GetMachineResourceGroupProps(result string) api.MachineResourceGroupProps {
id := GetIDFromTerraResults(result)

response, err := LwClient.V2.ResourceGroups.GetMachine(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props
}

func GetLwAccountResourceGroupProps(result string) api.LwAccountResourceGroupProps {
id := GetIDFromTerraResults(result)

response, err := LwOrgClient.V2.ResourceGroups.GetLwAccount(id)
if err != nil {
log.Fatalf("Unable to find resource group id: %s\n Response: %v", id, response)
}

return response.Data.Props
}

func GetAlertChannelProps(result string) api.AlertChannelResponse {
id := GetIDFromTerraResults(result)

Expand Down
Loading

0 comments on commit 79b6808

Please sign in to comment.