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

Refactor terraform code that automates creation of zip for source files #15

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

saskatchuwan
Copy link
Contributor

@saskatchuwan saskatchuwan commented Jul 15, 2024

We need to redo the tf code that automates the way we are constructing the cloud function zip file with source files due to tf's lack of support for properly archiving binary files without forcing us to encode it (see: hashicorp/terraform-provider-archive#149). We need a workaround to support adding python wheel files (binary) in order to build requirements.txt properly.

Dev tf plan output

Reference: https://stackoverflow.com/questions/56916719/is-there-a-way-to-define-multiple-source-file-for-terraform-archive-provider

Copy link
Contributor

@waltaskew waltaskew left a comment

Choose a reason for hiding this comment

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

cool -- the template stuff works with both text & binary files?


# Filenames are constructed to preserve source subdirectory structure within /temp
filename = "${path.module}/temp/${
contains(fileset(local.usl_lib_dir, "**/"), element(local.source_files, count.index)) ?
Copy link
Contributor

Choose a reason for hiding this comment

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

might consider making these three separate 'to_temp_dir' resources rather than one with a contains switch if you think that'd be more readable

@saskatchuwan
Copy link
Contributor Author

cool -- the template stuff works with both text & binary files?

It should - but i'm not able to test out the template stuff locally. with this approach, we aren't able to gen a local zip file when we do plan. i believe we will need to hit terraform apply for this to actually run e2e. the dev plan in the description should have the diff for the files that will get created if you can take a look to sanity check!

@saskatchuwan saskatchuwan merged commit 70aa42e into main Jul 15, 2024
@saskatchuwan saskatchuwan deleted the fix-wrf-python-patch branch July 15, 2024 19:51
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.

3 participants