From 4925411f1652b4e5bcaa3a9b7083579fc90b6a33 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Wed, 17 Jul 2024 18:04:51 +0000 Subject: [PATCH] feat: Require org_id for gcp agentless integration Signed-off-by: Lei Jin --- cli/cdk/go/proto/v1/cdk.pb.go | 5 +++-- cli/cdk/go/proto/v1/cdk_grpc.pb.go | 1 + cli/cmd/generate_gcp.go | 5 +++-- cli/docs/lacework_generate_cloud-account_gcp.md | 2 +- integration/test_resources/help/generate_cloud-account_gcp | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cli/cdk/go/proto/v1/cdk.pb.go b/cli/cdk/go/proto/v1/cdk.pb.go index 2e5716254..4ab3a18e6 100644 --- a/cli/cdk/go/proto/v1/cdk.pb.go +++ b/cli/cdk/go/proto/v1/cdk.pb.go @@ -25,11 +25,12 @@ package cdk import ( + reflect "reflect" + sync "sync" + timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/cli/cdk/go/proto/v1/cdk_grpc.pb.go b/cli/cdk/go/proto/v1/cdk_grpc.pb.go index 7431fd74e..3603a28ac 100644 --- a/cli/cdk/go/proto/v1/cdk_grpc.pb.go +++ b/cli/cdk/go/proto/v1/cdk_grpc.pb.go @@ -8,6 +8,7 @@ package cdk import ( context "context" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/cli/cmd/generate_gcp.go b/cli/cmd/generate_gcp.go index 630e6394f..016b7e7e3 100644 --- a/cli/cmd/generate_gcp.go +++ b/cli/cmd/generate_gcp.go @@ -315,7 +315,7 @@ func initGenerateGcpTfCommandFlags() { &GenerateGcpCommandState.GcpOrganizationId, "organization_id", "", - "specify the organization id (only set if organization_integration is set)") + "specify the organization id (only set if agentless integration or organization_integration is set)") generateGcpTfCommand.PersistentFlags().StringVar( &GenerateGcpCommandState.GcpProjectId, "project_id", @@ -716,6 +716,7 @@ func promptGcpGenerate( } configOrAuditLogEnabled := config.Configuration || config.AuditLog + organizationIdRequired := config.OrganizationIntegration || config.Agentless regionsInput := "" if err := SurveyMultipleQuestionWithValidation( @@ -738,7 +739,7 @@ func promptGcpGenerate( }, { Prompt: &survey.Input{Message: QuestionGcpOrganizationID, Default: config.GcpOrganizationId}, - Checks: []*bool{&config.OrganizationIntegration}, + Checks: []*bool{&organizationIdRequired}, Required: true, Response: &config.GcpOrganizationId, }, diff --git a/cli/docs/lacework_generate_cloud-account_gcp.md b/cli/docs/lacework_generate_cloud-account_gcp.md index c5eaca95f..c695dde0b 100644 --- a/cli/docs/lacework_generate_cloud-account_gcp.md +++ b/cli/docs/lacework_generate_cloud-account_gcp.md @@ -58,7 +58,7 @@ lacework generate cloud-account gcp [flags] -h, --help help for gcp --include_root_projects Disables logic that includes root-level projects if excluding folders (default true) --k8s_filter filter out GKE logs from GCP Audit Log sinks (default true) - --organization_id string specify the organization id (only set if organization_integration is set) + --organization_id string specify the organization id (only set if agentless integration or organization_integration is set) --organization_integration enable organization integration --output string location to write generated content (default is ~/lacework/gcp) --prefix string prefix that will be used at the beginning of every generated resource diff --git a/integration/test_resources/help/generate_cloud-account_gcp b/integration/test_resources/help/generate_cloud-account_gcp index b5efc231d..ad6aeb856 100644 --- a/integration/test_resources/help/generate_cloud-account_gcp +++ b/integration/test_resources/help/generate_cloud-account_gcp @@ -37,7 +37,7 @@ Flags: -h, --help help for gcp --include_root_projects Disables logic that includes root-level projects if excluding folders (default true) --k8s_filter filter out GKE logs from GCP Audit Log sinks (default true) - --organization_id string specify the organization id (only set if organization_integration is set) + --organization_id string specify the organization id (only set if agentless integration or organization_integration is set) --organization_integration enable organization integration --output string location to write generated content (default is ~/lacework/gcp) --prefix string prefix that will be used at the beginning of every generated resource