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

[WIP] Add node.js module containing Terraform interpolation functions #268

Closed
wants to merge 4 commits into from

Conversation

jen20
Copy link
Contributor

@jen20 jen20 commented Oct 29, 2018

This PR is work in progress to fix #267.

The interpolation functions in Terraform are as follows (checked off when part of this PR, or with notes beside them):

  • abs
  • basename
  • base64decode
  • base64encode
  • base64gzip - implemented but gzip options appear different so test cases do not pass 1-1
  • base64sha256
  • base64sha512
  • bcrypt
  • ceil
  • chomp
  • chunklist
  • cidrhost
  • cidrnetmask
  • cidrsubnet
  • coalesce
  • coalescelist
  • compact
  • concat
  • contains
  • dirname
  • distinct
  • element
  • file
  • flatten
  • floor
  • format
  • formatlist
  • indent
  • index
  • join
  • jsonencode
  • keys
  • length
  • list
  • log
  • lower
  • map
  • max
  • matchkeys
  • md5
  • merge
  • min
  • pathexpand
  • pow
  • uuid
  • replace
  • rsadecrypt
  • sha1
  • sha256
  • sha512
  • signum
  • slice
  • sort
  • split
  • substr
  • timestamp
  • timeadd
  • title
  • transpose
  • trimspace
  • upper
  • values
  • urlencode
  • zipmap

There is a minimal set of runtime dependencies (and several more development dependencies).

Still do do:

  • Implement remaining functions
  • Ensure appropriate documentation comments are included
  • Ensure the package build is hooked into the build system
  • Ensure all tests pass and are hooked into the build system

@jen20 jen20 added impact/usability Something that impacts users' ability to use the product easily and intuitively language/javascript feature/refresh labels Oct 29, 2018
@jen20 jen20 added this to the 0.19 milestone Oct 29, 2018
Copy link
Contributor

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

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

On top of the work here - I assume we'll need to also start building and publishing an actual @pulumi/terraform package out of this repo?

* @param path the full path
*/
export function basename(path: string): string {
return Path.win32.basename(path);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this use win32 basename?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe that is the behaviour that Terraform uses filepath.basename instead of path.basename in order to deal with Windows paths correctly. I added a test for this case to ensure it works with both types.

sdk/nodejs/index.ts Outdated Show resolved Hide resolved
sdk/nodejs/index.ts Outdated Show resolved Hide resolved
sdk/nodejs/index.ts Outdated Show resolved Hide resolved
sdk/nodejs/tests/tests.ts Outdated Show resolved Hide resolved
@jen20 jen20 force-pushed the terraform-functions-sdk branch from 434b893 to cf8022a Compare November 9, 2018 19:37
@jen20 jen20 force-pushed the terraform-functions-sdk branch from cadf732 to 7cdd3ca Compare March 13, 2019 17:14
@jen20 jen20 force-pushed the terraform-functions-sdk branch from 51be5ce to 314a913 Compare March 14, 2019 14:58
@jen20 jen20 requested a review from ellismg March 14, 2019 17:54
@jen20
Copy link
Contributor Author

jen20 commented Mar 14, 2019

@ellismg, as discussed, I've tagged you for review to ensure that the build system is correct. I've not yet pulled in the package publishing script, but once the tests are passing in Travis CI, I will do so.

@jen20 jen20 force-pushed the terraform-functions-sdk branch from eeac6d5 to ae726f5 Compare March 14, 2019 17:55
@lukehoban
Copy link
Contributor

This is quite stale now - so I'll close it out for now. If/when we want to come back to it there's some great work in this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/refresh impact/usability Something that impacts users' ability to use the product easily and intuitively language/javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a package for built-in functions
2 participants