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

Create initial provider #1

Merged
merged 32 commits into from
Dec 25, 2019
Merged

Create initial provider #1

merged 32 commits into from
Dec 25, 2019

Conversation

tptee
Copy link
Contributor

@tptee tptee commented Dec 12, 2019

Creates the initial serverless_deployment resource which wraps the Serverless CLI. Only runs sls deploy when the contents of serverless.yml and the package ZIP archive contents change. Assumes that users run packaging out-of-band.

Hoping to split docs and niceties into another PR while we dogfood the provider.

Example:

resource "serverless_deployment" "example" {
  config_path         = abspath("./")
  serverless_bin_path = abspath("./node_modules/.bin/serverless")
  # Relative to config path
  package_dir         = ".terraform-serverless"
  stage               = "sandbox"
}

To test, you need access to the Formidable account set up with aws-vault. Run aws-vault exec formidable then make testacc.

@dmmulroy I'd love your input here since you have some experience with Go!

@tptee tptee requested a review from dmmulroy December 12, 2019 23:00
@tptee tptee requested a review from ryan-roemer December 13, 2019 04:09
@tptee
Copy link
Contributor Author

tptee commented Dec 13, 2019

Ready for another look!

@tptee tptee requested a review from ryan-roemer December 13, 2019 17:07
return config.Service, err
}

func hashServerlessDir(configDir string, packagePath string, configJson []byte) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we get some comments as to what we're hashing, why, and what scenarios we're trying to cache / skip over?

},
"serverless_bin_dir": &schema.Schema{
Type: schema.TypeString,
Required: true,
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to make this not required and instead default to CWD?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My gut is that would be more error-prone, as I haven't seen a project share Terraform modules and serverless.yml/node_modules in the same CWD before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you know what, might be nice to default it to the node_modules in the config_dir!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the above the default!

@ryan-roemer
Copy link
Member

Looking great so far! In addition to my current review pass comments, can we maybe get a CONTRIBUTING.md document that has sections for:

  • Development: Localdev installation, running the tests, running lint, doing a deploy from example (with installation, etc. instructions)
  • Release: Since git tags should cause a full release, maybe just giving guidance for that via straight git commands since we don't have a root package.json for scripts? (Or something of your choosing).

Here's https://github.com/FormidableLabs/terraform-aws-serverless/blob/master/CONTRIBUTING.md for reference which has some of what you may want if that's useful!

@tptee tptee requested a review from ryan-roemer December 13, 2019 19:06
@tptee
Copy link
Contributor Author

tptee commented Dec 13, 2019

Should be ready for another pass!

Copy link
Member

@ryan-roemer ryan-roemer left a comment

Choose a reason for hiding this comment

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

Everything outside of the go code (which I'm not familiar with) looks good!

I think we do need a README.md with full integration instructions as this is a departure from normal SLS workflows and such, particularly for the packaging part if you have to somehow do that outside terraform or can do this with additional config within this provider because that's likely going to be a large stumbling block for our users.

@tptee
Copy link
Contributor Author

tptee commented Dec 16, 2019

Added README!

Copy link
Contributor

@dmmulroy dmmulroy left a comment

Choose a reason for hiding this comment

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

Only skimmed the Go, but lgtm

@tptee tptee merged commit fc8cdca into master Dec 25, 2019
@tptee tptee deleted the feature/initial branch December 25, 2019 05:37
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