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

TME-2307: add support for existing trail with x-account resources #46

Merged
merged 16 commits into from
Aug 15, 2023

Conversation

sarjumulmi
Copy link
Contributor

@sarjumulmi sarjumulmi commented Aug 7, 2023

Add support for existing cloudtrail with resources deployed in different aws accounts.

Changes:

  • configuration_alias added for log bucket account. need to pass in the provider alias for log bucket when invoking the module
  • conditionally create resources based on is_existing_cloudtrail_cross_account var
  • local runtime check for assuring other dependent optional variables are provided when is_existing_cloudtrail_cross_account is set to true.
  • new variable for expel assume role name instead of hard coded string. add type defn for tags
  • change circle ci config as a workaround for terraform validate bug

variables.tf Show resolved Hide resolved
@sarjumulmi sarjumulmi force-pushed the TME-2307-one-module branch 3 times, most recently from 8e893b2 to 2ae4192 Compare August 7, 2023 20:19
@sarjumulmi sarjumulmi force-pushed the TME-2307-one-module branch from 2ae4192 to 94a97a4 Compare August 7, 2023 20:24
@sarjumulmi sarjumulmi requested a review from bachu20 August 7, 2023 20:28
bachu20
bachu20 previously approved these changes Aug 8, 2023
Copy link
Contributor

@bachu20 bachu20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Would definitely defer to @davidmontoyago + @ethanmil for reviews before merging it in.

README.md Outdated
| <a name="input_expel_customer_aws_account_id"></a> [expel\_customer\_aws\_account\_id](#input\_expel\_customer\_aws\_account\_id) | Account id of customer's AWS account that will be monitored by Expel if it is different than the one terraform is using. This should be the management account id if organization trail is enabled. | `string` | `null` | no |
| <a name="input_is_existing_cloudtrail_cross_account"></a> [is\_existing\_cloudtrail\_cross\_account](#input\_is\_existing\_cloudtrail\_cross\_account) | For an existing cloudtrail, whether the cloudtrail & the log bucket (& optinally log bucket notifier topic if existing) are in different aws accounts | `bool` | `false` | no |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this applies to cases where you have an existing organization cloudtrail but the cloudtrail log bucket account is NOT in the management account.

Copy link
Contributor

@ethanmil ethanmil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just a few typos and readability suggestions.

.circleci/config.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
s3.tf Outdated Show resolved Hide resolved
terraform.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
Copy link
Contributor

@davidmontoyago davidmontoyago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pair-reviewed with @ethanmil

@sarjumulmi sarjumulmi force-pushed the TME-2307-one-module branch from ad84d80 to eaa5178 Compare August 10, 2023 19:57
davidmontoyago
davidmontoyago previously approved these changes Aug 14, 2023
Copy link
Contributor

@davidmontoyago davidmontoyago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +95 to +101
command: |
cat > provider.tf \<<EOF
provider "aws" {
region = "us-east-1"
alias = "log_bucket"
}
EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

ethanmil
ethanmil previously approved these changes Aug 14, 2023
Copy link
Contributor

@ethanmil ethanmil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sarjumulmi sarjumulmi dismissed stale reviews from ethanmil and davidmontoyago via 0bc6649 August 14, 2023 20:31
@sarjumulmi sarjumulmi force-pushed the TME-2307-one-module branch from 0bc6649 to 372aeda Compare August 14, 2023 20:34
Copy link
Contributor

@davidmontoyago davidmontoyago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additions 372aeda and 1a33527 LGTM

@sarjumulmi sarjumulmi merged commit d3270e1 into main Aug 15, 2023
@sarjumulmi sarjumulmi deleted the TME-2307-one-module branch August 15, 2023 14:34
@bachu20 bachu20 linked an issue Sep 5, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't pass tags in via Terragrunt
4 participants