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(cli): --subaccount flag to manage sub-accounts #177

Closed
wants to merge 4 commits into from

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Jul 28, 2020

This change will allow users to manage sub-accounts with a new flag named --subaccount.

To list integrations from the primary account

$ lacework integrations list

To list integrations from a sub-account

$ lacework integrations list --subaccount sub-account-name

Additionally, it is possible to configure a persistent sub-account with the command:

$ lacework configure --subaccount sub-account-name

To remove the configured sub-account use the --remove_subaccount flag:

$ lacework configure --remove_subaccount

Finally, this new flag comes with its environment variable LW_SUBACCOUNT that can be
used to override settings coming from the Lacework configuration file.

Signed-off-by: Salim Afiune Maya afiune@lacework.net

@afiune afiune force-pushed the afiune/manage-tenants branch from 23592c3 to 74163f7 Compare July 29, 2020 14:52
@afiune afiune self-assigned this Jul 29, 2020
@afiune afiune added ci Continuous Integration feat New feature or request labels Jul 29, 2020
@afiune afiune requested a review from scottford-lw July 29, 2020 14:52
@afiune afiune force-pushed the afiune/manage-tenants branch 3 times, most recently from a311cbe to f9b42fd Compare July 31, 2020 14:16
afiune added 2 commits July 31, 2020 08:16
This change will allow users to manage sub-accounts (tenants) with a new
flag named `--tenant`

To list integrations from the organization account
```
$ lacework integrations list
```

To list integrations from a sub-account
```
$ lacework integrations list --tenant sub-account
```

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
A user will be able to configure a persistent tenant with the command:
```
$ lacework configure --tenant sub-account
```

To remove the configured tenant use the `--remove_tenant` flag:
```
$ lacework configure --remove_tenant
```

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
@afiune afiune force-pushed the afiune/manage-tenants branch from f9b42fd to c1f14b4 Compare July 31, 2020 14:16
afiune added a commit to hashicorp/terraform-provider-lacework that referenced this pull request Jul 31, 2020
This change is adding a new argument to our provider named `tenant`,
it is otional and allows Organization Admins to manage multiple
sub-accounts with a single API key. It can also be sourced from the
`LW_TENANT` environment variable, or via the configuration file if
`profile` is specified.

Example: having a single API key with Organization Admin priviledges
configured into the local Lacework CLI configuratio file at
`~/.lacework.toml`:
```toml
[default]
  account = "primary-account"
  api_key = "my-org-admin-key"
  api_secret = "my-org-admin-secret"
```

You can configure the Lacework provider to point to multipel
sub-accounts using this new argument:
```hcl
provider "lacework" {
  alias = "primary"
}

provider "lacework" {
  alias  = "subaccount1"
  tenant = "subaccount1"
}

provider "lacework" {
  alias  = "subaccount2"
  tenant = "subaccount2"
}

provider "lacework" {
  alias  = "subaccountN"
  tenant = "subaccountN"
}
```

Depends on lacework/go-sdk#177

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
afiune added a commit to hashicorp/terraform-provider-lacework that referenced this pull request Jul 31, 2020
This change is adding a new argument to our provider named `tenant`,
it is otional and allows Organization Admins to manage multiple
sub-accounts with a single API key. It can also be sourced from the
`LW_TENANT` environment variable, or via the configuration file if
`profile` is specified.

Example: having a single API key with Organization Admin priviledges
configured into the local Lacework CLI configuratio file at
`~/.lacework.toml`:
```toml
[default]
  account = "primary-account"
  api_key = "my-org-admin-key"
  api_secret = "my-org-admin-secret"
```

You can configure the Lacework provider to point to multipel
sub-accounts using this new argument:
```hcl
provider "lacework" {
  alias = "primary"
}

provider "lacework" {
  alias  = "subaccount1"
  tenant = "subaccount1"
}

provider "lacework" {
  alias  = "subaccount2"
  tenant = "subaccount2"
}

provider "lacework" {
  alias  = "subaccountN"
  tenant = "subaccountN"
}
```

Depends on lacework/go-sdk#177

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
@afiune
Copy link
Contributor Author

afiune commented Aug 3, 2020

We need to change this PR to match the terminology from our documentation,
instead of --tenant this argument needs to be called --subaccount.

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
@afiune afiune changed the title feat(cli): --tenant flag to manage sub-accounts feat(cli): --subaccount flag to manage sub-accounts Aug 4, 2020
@afiune afiune marked this pull request as draft October 26, 2020 19:36
@afiune afiune changed the base branch from master to afiune/api/v2 February 16, 2021 02:12
@afiune afiune changed the base branch from afiune/api/v2 to APIv2 February 16, 2021 02:18
@afiune
Copy link
Contributor Author

afiune commented Jun 3, 2021

Superseded by #431

@afiune afiune closed this Jun 3, 2021
@afiune afiune deleted the afiune/manage-tenants branch June 3, 2021 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant