-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Adding origin shield variables #78
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 ⬇️
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_GENERAL_27 Added /main.tf aws_cloudfront_distribution.default
@SweetOps |
main.tf
Outdated
@@ -72,6 +72,14 @@ resource "aws_cloudfront_distribution" "default" { | |||
origin_read_timeout = var.origin_read_timeout | |||
} | |||
|
|||
dynamic "origin_shield" { | |||
for_each = var.origin_shield_enabled ? ["true"] : [] |
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.
What if you enabled it and then disabled it? it looks like it would remove the block if it was disabled, but would it actually disable it if the block was removed? or would enabled have to be explicitly set to origin_shield_enabled without the for_each?
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.
The API isn't very consistent. I've tried two ways of doing this and enabling/disabling, both seem to require a third step to apply cleanly.
- Use a dynamic
origin_shield
block
The Origin shield is not disabled when the block is removed. Applying again will cause the same changes to be planned.
- Using a persistent
origin_shield
block
When setting enabled
to false
it works. Applying again will cause the plan to want to add in the origin_shield
block again.
I'm putting in a change now to have an origin_shield
variable that is an object to match the existing provider definition more closely.
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.
This is now a two-step process to remove, which is the same as the underlying resource.
- Set
origin_shield.enabled
to `false. - Apply
- Remove the
origin_shield
variable. - Apply
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
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_GENERAL_27 Added /main.tf aws_cloudfront_distribution.default
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_GENERAL_27 Added /main.tf aws_cloudfront_distribution.default
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_GENERAL_27 Added /main.tf aws_cloudfront_distribution.default
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_GENERAL_27 Added /main.tf aws_cloudfront_distribution.default
Seems like https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn/blob/master/main.tf#L329 just needs to be replicated here. |
/test all |
/test all |
/test all |
what
why
references