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

[Docs]: Add support for package version overrides on aws_amplify_app resource #27768

Open
anasillo opened this issue Nov 11, 2022 · 1 comment
Labels
documentation Introduces or discusses updates to documentation. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/amplify Issues and PRs that pertain to the amplify service.

Comments

@anasillo
Copy link
Contributor

Documentation Link

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_app

Description

As stated on the AWS official Amplify Build Settings docs the Node version used is the latest one unless something else is specified on the package.json. While having on Amplify a different version than the package.json file could be not the best practice, there might be a need for overriding this for some builds. The steps for doing this are very well explained on the official AWS next (with Next.js instead of Node but still the same) Updating the Next.js version for an existing app.

While looking at the aws_amplify_app docs there are no indications about how to do that, so we usually ended up adding this manually and getting the changes from the plan. What essentially is needed, is to add the following code block

  environment_variables = {
    "_LIVE_UPDATES" = jsonencode([
      {
        pkg     = "<package-name>"
        type    = "<package-type>"
        version = "<package-version>"
      },
    ])})

Used as the following example:

  environment_variables = {
    "_LIVE_UPDATES" = jsonencode([
      {
        pkg     = "node"
        type    = "nvm"
        version = "9"
      },
    ])})

Note 1: Please note that this might not only apply for Node.js versions but for other package version overrides as the ones that are allowed on Amplify

image


Note 2: If you think about it, the _LIVE_UPDATES env-var could also be an independent map outside the environment_variables and moreover could be a standalone resource to override package versions.

resource "aws_amplify_app" "main" {
  name       = "myapp"
  ....
}

resource "aws_amplify_app_build_settings" "main" {
 app_id = aws_amplify_app.main.id

 build_settings = {
   custom_image = ${_CUSTOM_IMAGE}
   live_setting = ${_LIVE_UPDATES}
  ....
}

image

References

Build Settings
Updating the Next.js version for an existing app
Relates to #27319

Would you like to implement a fix?

No

@anasillo anasillo added documentation Introduces or discusses updates to documentation. needs-triage Waiting for first response or review from a maintainer. labels Nov 11, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/amplify Issues and PRs that pertain to the amplify service. label Nov 11, 2022
@justinretzolk justinretzolk added good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/amplify Issues and PRs that pertain to the amplify service.
Projects
None yet
Development

No branches or pull requests

2 participants