diff --git a/cli/cmd/generate.go b/cli/cmd/generate.go index a94ece6f1..6bb5b640e 100644 --- a/cli/cmd/generate.go +++ b/cli/cmd/generate.go @@ -31,7 +31,7 @@ var ( Long: `Generate code to onboard your account and deploy Lacework into various cloud environments. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. `, } ) @@ -50,6 +50,18 @@ func init() { // aws subcommands generateAwsTfCommand.AddCommand(generateAwsControlTowerTfCommand) + + // Common flags + generateTfCommand.PersistentFlags().Bool( + "apply", + false, + "run terraform apply without executing plan or prompting", + ) + generateTfCommand.PersistentFlags().String( + "output", + "", + "location to write generated content", + ) } type SurveyQuestionWithValidationArgs struct { diff --git a/cli/cmd/generate_cloud_account.go b/cli/cmd/generate_cloud_account.go index bebcae4b8..999ff9b23 100644 --- a/cli/cmd/generate_cloud_account.go +++ b/cli/cmd/generate_cloud_account.go @@ -10,7 +10,7 @@ var ( Long: `Generate cloud-account IaC to deploy Lacework into a cloud environment. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. `, } ) diff --git a/cli/docs/lacework_generate.md b/cli/docs/lacework_generate.md index ffc4a7287..7bb74025f 100644 --- a/cli/docs/lacework_generate.md +++ b/cli/docs/lacework_generate.md @@ -13,13 +13,15 @@ Generate code to onboard your account Generate code to onboard your account and deploy Lacework into various cloud environments. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. ### Options ``` - -h, --help help for generate + --apply run terraform apply without executing plan or prompting + -h, --help help for generate + --output string location to write generated content ``` ### Options inherited from parent commands diff --git a/cli/docs/lacework_generate_cloud-account.md b/cli/docs/lacework_generate_cloud-account.md index c1f662968..2ba9ddc02 100644 --- a/cli/docs/lacework_generate_cloud-account.md +++ b/cli/docs/lacework_generate_cloud-account.md @@ -13,7 +13,7 @@ Generate cloud integration IaC Generate cloud-account IaC to deploy Lacework into a cloud environment. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. ### Options @@ -29,12 +29,14 @@ Terraform and deploying Lacework into AWS, Azure, or GCP. -k, --api_key string access key id -s, --api_secret string secret access key --api_token string access token (replaces the use of api_key and api_secret) + --apply run terraform apply without executing plan or prompting --debug turn on debug logging --json switch commands output from human-readable to json format --nocache turn off caching --nocolor turn off colors --noninteractive turn off interactive mode (disable spinners, prompts, etc.) --organization access organization level data sets (org admins only) + --output string location to write generated content -p, --profile string switch between profiles configured at ~/.lacework.toml --subaccount string sub-account name inside your organization (org admins only) ``` diff --git a/cli/docs/lacework_generate_k8s.md b/cli/docs/lacework_generate_k8s.md index af7e20583..1a4669a4f 100644 --- a/cli/docs/lacework_generate_k8s.md +++ b/cli/docs/lacework_generate_k8s.md @@ -29,12 +29,14 @@ Terraform and deploying Lacework into GKE. -k, --api_key string access key id -s, --api_secret string secret access key --api_token string access token (replaces the use of api_key and api_secret) + --apply run terraform apply without executing plan or prompting --debug turn on debug logging --json switch commands output from human-readable to json format --nocache turn off caching --nocolor turn off colors --noninteractive turn off interactive mode (disable spinners, prompts, etc.) --organization access organization level data sets (org admins only) + --output string location to write generated content -p, --profile string switch between profiles configured at ~/.lacework.toml --subaccount string sub-account name inside your organization (org admins only) ``` diff --git a/go.mod b/go.mod index e47db30e2..6cd0604fd 100644 --- a/go.mod +++ b/go.mod @@ -59,6 +59,7 @@ require ( github.com/gabriel-vasile/mimetype v1.4.2 github.com/go-git/go-git/v5 v5.5.2 github.com/go-resty/resty/v2 v2.10.0 + github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 github.com/hashicorp/consul/sdk v0.13.1 github.com/mattn/go-isatty v0.0.18 @@ -101,7 +102,6 @@ require ( github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.4.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect diff --git a/integration/test_resources/help/generate b/integration/test_resources/help/generate index 28bb84c4a..fce1971b5 100644 --- a/integration/test_resources/help/generate +++ b/integration/test_resources/help/generate @@ -1,7 +1,7 @@ Generate code to onboard your account and deploy Lacework into various cloud environments. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. Usage: lacework generate [command] @@ -14,7 +14,9 @@ Available Commands: k8s Generate Kubernetes integration IaC Flags: - -h, --help help for generate + --apply run terraform apply without executing plan or prompting + -h, --help help for generate + --output string location to write generated content Global Flags: -a, --account string account subdomain of URL (i.e. .lacework.net) diff --git a/integration/test_resources/help/generate_cloud-account b/integration/test_resources/help/generate_cloud-account index 45dd6d25f..f4d49d0a1 100644 --- a/integration/test_resources/help/generate_cloud-account +++ b/integration/test_resources/help/generate_cloud-account @@ -1,7 +1,7 @@ Generate cloud-account IaC to deploy Lacework into a cloud environment. This command creates Infrastructure as Code (IaC) in the form of Terraform HCL, with the option of running -Terraform and deploying Lacework into AWS, Azure, or GCP. +Terraform and deploying Lacework into AWS, Azure, GCP or OCI. Usage: lacework generate cloud-account [command] @@ -23,12 +23,14 @@ Global Flags: -k, --api_key string access key id -s, --api_secret string secret access key --api_token string access token (replaces the use of api_key and api_secret) + --apply run terraform apply without executing plan or prompting --debug turn on debug logging --json switch commands output from human-readable to json format --nocache turn off caching --nocolor turn off colors --noninteractive turn off interactive mode (disable spinners, prompts, etc.) --organization access organization level data sets (org admins only) + --output string location to write generated content -p, --profile string switch between profiles configured at ~/.lacework.toml --subaccount string sub-account name inside your organization (org admins only) diff --git a/integration/test_resources/help/generate_k8s b/integration/test_resources/help/generate_k8s index f00e3218c..2100a25f3 100644 --- a/integration/test_resources/help/generate_k8s +++ b/integration/test_resources/help/generate_k8s @@ -18,12 +18,14 @@ Global Flags: -k, --api_key string access key id -s, --api_secret string secret access key --api_token string access token (replaces the use of api_key and api_secret) + --apply run terraform apply without executing plan or prompting --debug turn on debug logging --json switch commands output from human-readable to json format --nocache turn off caching --nocolor turn off colors --noninteractive turn off interactive mode (disable spinners, prompts, etc.) --organization access organization level data sets (org admins only) + --output string location to write generated content -p, --profile string switch between profiles configured at ~/.lacework.toml --subaccount string sub-account name inside your organization (org admins only)