-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix: create records using for_each
instead of count
#37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bridgecrew has found infrastructure configuration errors in this PR ⬇️
main.tf
Outdated
@@ -6,9 +6,9 @@ data "aws_route53_zone" "default" { | |||
} | |||
|
|||
resource "aws_route53_record" "default" { | |||
count = module.this.enabled ? length(compact(var.aliases)) : 0 | |||
for_each = module.this.enabled ? toset(compact(var.aliases)) : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure Route53 A Record has an attached resource
Resource: aws_route53_record.default | ID: BC_AWS_GENERAL_95
Description
This check ensures that Route53 A records point to resources part of your Account rather than just random IP addresses. On the platform this check additionally compares IP's against provisioned EIP. In Checkov the graph correlates the A record against know AWS resources from EIP to Global Accelerator.
main.tf
Outdated
@@ -6,9 +6,9 @@ data "aws_route53_zone" "default" { | |||
} | |||
|
|||
resource "aws_route53_record" "default" { | |||
count = module.this.enabled ? length(compact(var.aliases)) : 0 | |||
for_each = module.this.enabled ? toset(compact(var.aliases)) : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure Route 53 entries relate to account resources only
Resource: aws_route53_record.default | ID: BC_AWS_NETWORKING_60
Description
Checks that all A records in Route 53 point to resources created in the current AWS account.#Rationale
A check to protect against domain hijacking, where an unrelated IP address is added to an AWS managed DNS zone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
for_each
instead of count
/test all |
This Pull Request has been updated, so we're dismissing all reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change details
-
Error ID Change Path Resource BC_AWS_NETWORKING_60 Added /main.tf aws_route53_record.default BC_AWS_GENERAL_95 Added /main.tf aws_route53_record.default
This pull request is now in conflict. Could you fix it @1david5? 🙏 |
Hope you don't mind I take this opportunity to update the contributors list in |
/test all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Note that this is a minor release because it will cause destruction and recreation of resources due to the address change. |
Perfect. thank you @korenyoni 👍 |
what
default
andipv6
aws_route53_record
resources to usefor_each
instead ofcount
.why
aliases
list.