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

dynamically create website inputs with the new provider and its colli… #142

Closed

Conversation

jurgen-weber-deltatre
Copy link

@jurgen-weber-deltatre jurgen-weber-deltatre commented Mar 14, 2022

…ding options

what

  • this fixes type issues and changes with the new AWS provider for website inputs

why

references

@nitrocode
Copy link
Member

We don't have a test for this yet. If that could be added to the completr test then that would ensure this functionality works correctly going forward

redirect_all_requests_to = string
routing_rules = string
}))
type = map(any)
default = null
Copy link
Member

Choose a reason for hiding this comment

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

could we keep the variable type the same for backwards compatibility?

Choose a reason for hiding this comment

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

Sure, but as linked 'redirect_all_requests_to' is mutually exclusive with the other 3 options.. So, you are either setting 'redirect_all_requests_to' or 'index_document', 'error_document' and 'routing_rules'. Not sure how to handle that? I saw there is an experimental 'optional' feature but that is subject to change.

Choose a reason for hiding this comment

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

Hi, I would really appreciate some feedback to this, not sure how to handle it.

Copy link
Member

Choose a reason for hiding this comment

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

the workaround has been to set unused options to null but maybe your way is the correct way forward, provided backwards compatibility is maintained

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this never worked in v2.0, I'm OK with having a breaking change here. Unfortunately, the "optional" feature is not usable (changes to it have been announced).

Let's make this 2 inputs.

  1. website_redirect_all_requests_to which is a list(object) with host_name and protocol and a validation of length <= 2 and default []
  2. website_configuration which is list(object) with the remaining configuration, including a list of routing_rule objects, and a validation of length <= 2 and default []

What do you think @jurgen-weber-deltatre and @nitrocode ?

@jurgen-weber-deltatre
Copy link
Author

We don't have a test for this yet. If that could be added to the completr test then that would ensure this functionality works correctly going forward

ok, never used that tool but I Can have a look tomorrow.

@nitrocode
Copy link
Member

ok, never used that tool but I Can have a look tomorrow.

the tests are built into the module and many tests are built into the examples/complete module and verified via test/src directory. If both can be expanded to include website inputs, then we can verify the changes coming in from this PR

nitrocode
nitrocode previously approved these changes Apr 15, 2022
@nitrocode
Copy link
Member

/test test/bats

@nitrocode
Copy link
Member

/test test/readme

@nitrocode
Copy link
Member

/test test/terratest

@mergify mergify bot dismissed nitrocode’s stale review April 21, 2022 00:29

This Pull Request has been updated, so we're dismissing all reviews.

Nuru
Nuru previously requested changes Apr 21, 2022
@@ -90,24 +90,36 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
}

resource "aws_s3_bucket_website_configuration" "default" {
for_each = local.enabled && var.website_inputs != null ? toset(var.website_inputs) : toset([])
for_each = local.enabled && var.website_inputs != null ? var.website_inputs : {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This cannot and should not be for_each, because you can only have one configuration per bucket

redirect_all_requests_to = string
routing_rules = string
}))
type = map(any)
default = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this never worked in v2.0, I'm OK with having a breaking change here. Unfortunately, the "optional" feature is not usable (changes to it have been announced).

Let's make this 2 inputs.

  1. website_redirect_all_requests_to which is a list(object) with host_name and protocol and a validation of length <= 2 and default []
  2. website_configuration which is list(object) with the remaining configuration, including a list of routing_rule objects, and a validation of length <= 2 and default []

What do you think @jurgen-weber-deltatre and @nitrocode ?

@Nuru
Copy link
Contributor

Nuru commented Apr 21, 2022

@jurgen-weber-deltatre After implementing website_redirect_all_requests_to and website_configuration, please follow the pattern in https://github.com/cloudposse/terraform-aws-s3-bucket/blob/master/variables-deprecated.tf to make website_inputs deprecated and transform it into the new inputs.

Please also add bucket_website_endpoint output, along the lines of our s3-website module.

@mergify mergify bot dismissed Nuru’s stale review May 6, 2022 18:47

This Pull Request has been updated, so we're dismissing all reviews.

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.

Unable to use website inputs
5 participants