AWS announced AWS Amplify Console at reinvent 2018.
AWS Amplify Console is a continuous deployment and hosting service for modern web applications with serverless backends. Modern web applications include single page app frameworks like React, Angular, and Vue, and static-site generators like Jekyll, Hugo, and Gatsby.
Here are some possible resources:
aws_amplify_console_app
aws_amplify_console_branch
aws_amplify_console_domain_association
Do we know if there's any progress on this, or if it's even made it into the roadmap ?
Hi, any progress with this one?
So it looks like the ability to connect with amplify has been added to the provider codebase (in #9874), I guess now we await if anyone PR's the resources mentioned above?
Hi, I experimentally implemented the following resources:
After adding validations and tests, I'll make a PR. Any comments are welcome.
I opened the following PRs:
Is there any news on this, things seem to have stalled out?
@k24d That's a good question, not sure who is supposed to be pinged but it looks like you have done the work to get the PR reviewed (though it is failing the tests?) so...
As an aside, thanks for putting this all together!
@heschlie Oh, right. The tests failed because of broken documentation. I have fixed it now.
Hi @bflad, I'd like to get #11928 reviewed. What should I do?
Hey @bflad @k24d -- Sorry to bug you folks, but is there anything we can do to help move this forward?
Please vote on #11928 by adding a 馃憤 reaction to help the community and maintainers prioritize the pull request.
I described how to build terraform-provider-aws with Amplify resources:
https://github.com/k24d/terraform-provider-aws/blob/amplify/README-amplify.md
Please try it and let me know if you have any problems.
@k24d Great stuff! Thank you for putting the README together and all the hardwork on these new resources. I finally got a chance to check them out and they're working well for my use-cases.
I've got a pretty simple module put together that I'm using for some of my personal and business sites and planning on using for a client. You can check that out here: masterpointio/terraform-aws-amplify-app.
Regarding feedback, overall it seems super stable and well done, but here are a few things I noticed that I figure will be good items to tackle at some point:
enable_basic_auth = false
on the branch resource (possibly on the app resource as well) seems to always trigger an "update-in-place" apply. The resource thinks it needs to add the full basic_auth_config
block to the resource every time. This is a common terraform problem that I've seen with a lot of resources, so I'm sure this category of problems is just a general PITA but I figured I should point it out. If you want an example of this, I'd be happy so show you. aws_amplify_domain_association
resource seems to want to re-order the sub_domain_settings
fields according to ordering of the Amplify console. So those configuration blocks always act as if they need an "update-in-place" apply as well.local-exec
(see here), but it would be awesome if the amplify resource or branch did that for me implicitly. Though maybe that should be up for discussion?Anyway, again great work -- It's much appreciated! I'm stoked for when these resources finally land!
@Gowiem Thank you for your feedback!
Right. Unfortunately, you have to delete the whole basic_auth_config
block in order to disable it without diffs. I'll try to find a way to avoid the issue.
I can't reproduce the issue. Could you give me an example?
This is because AWS API, unlike Amplify Console, does not trigger builds just by creating resources. I think this is acceptable because the initial build is not a state. You can start the initial build by running aws amplify start-job
. How about adding an example for the initial build in the document?
@k24d 馃憤
Yeah, knew it was a PITA for some reason. Good luck on finding a fix!
This is reproducible using my module. The specific domain association resource is this one. It creates a consistent diff like this:
Sounds fine to me, I have my solution via the webhook method and that seems reasonable. Adding a note/example to kick off the first build as an update to the documentation would be great.
@k24d Just on-boarded a client to use this module for a proof of concept, so one new question here:
Also, side note for any watchers of this issue since the recently released AWS provider roadmap doesn't include merging this Amplify work: I created a Makefile
for downloading the forked AWS provider that includes these resources. You can check that out here. Hoping that will help others use these resources prior to Terraform prioritizing this work.
@Gowiem You can use AWS CLI to examine how AWS implements a particular feature provided by AWS Management Console. In this case, it seems AWS uses the environment variable "_CUSTOM_IMAGE":
$ aws amplify list-apps
{
"apps": [
{
"appId": "dmhvrv1x8jqg",
...
"environmentVariables": {
"_CUSTOM_IMAGE": "0123456789.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest"
},
}
]
}
Can you try to set the same environment variable from Terraform?
@k24d Aha interesting, thanks for the pointer. I'll give that a shot if it comes up again. I ended up putting together a somewhat ugly build_spec to get around not having custom image support, so I'm good for now.
As for others, I think it'd be a good call to mention how to supply a custom image in the Amplify App resource Docs.
Any updates on this?
Hey @k24d -- Just ran into a couple things and I thought I'd run it by you and see if you had any thoughts:
I had previously set build_spec
to some static YAML content for one of my projects, but now I want to use the build_spec.yml
from the repo in question and AWS doesn't seem to want to use that if the build spec is set via the API / Console AFAICT. Therefore, I'm attempting to effectively remove setting the build_spec
by setting aws_amplify_app
's build_spec
variable to null
or ""
. I've attempted a few different ways, but all plan
s never result in the resource triggering an update. Is there something I'm missing there? Do I need to rebuild my amplify app to accomplish this? Bug or expected behavior?
It seems that setting basic auth required on a branch does not extend to the PR previews against that branch. Is that possible or is that an ability that is lacking on the AWS / API side?
Hi @Gowiem
Can you set build_spec
to null
or ""
by using AWS CLI? I often noticed that many parameters cannot be set to ""
because ""
means "the parameter is missing", and the API does not change the existing value in that case. I couldn't find a way to clear the value. You need to recreate the entire Amplify App in this case.
I'm not sure about that. Please try the same thing by AWS CLI.
@k24d Yeah you're right on #1 -- Seems AWS doesn't allow this. Regarding #2, I needed to set the basic auth on the root project and not on the branches, which seems right. Your work allowed me to do that so all good there. Thanks again!
Hey all, I've posted about this set of resources stalling out in the community forum, please share that around if you can so we can push these PRs forward!
Hi all. A few months ago I received the following automated comment for #11928, which says some updates are required:
https://github.com/terraform-providers/terraform-provider-aws/pull/11928#issuecomment-675710953
However, I stopped using Amplify in my projects and I have no strong motivation to update these PRs. Is there anybody who can continue the work?
@k24d Ah sorry to hear! I may have time in December / January to continue the work. I'll follow up then if I end up being able to take it on. I'm sure I'll have questions for you if so.
@k24d I can take this up.
I'm using Amplify in my current projects and right now we are using cloud formation resource to create it.
I would need a bit of help on getting started though
@Gowiem @ashishmohite Thanks. Feel free to ask me if you have any questions.
@k24d how do i fork your repo+branch ? I tried fork but it didn't bring the f-amplify-app
branch
@ashishmohite The branch is in my fork repository. Please fetch the code from there.
# Your repository
% git clone https://github.com/terraform-providers/terraform-provider-aws.git
% cd terraform-provider-aws
# Fetch my fork
% git remote add k24d https://github.com/k24d/terraform-provider-aws.git
% git fetch k24d
# Create a new working branch
% git checkout -b f-amplify-app
# Merge my fork branch
% git merge k24d/f-amplify-app
CONFLICT (modify/delete): website/aws.erb deleted in HEAD and modified in k24d/f-amplify-app. Version k24d/f-amplify-app of website/aws.erb left in tree.
Auto-merging website/allowed-subcategories.txt
Auto-merging aws/provider.go
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 4501 and retry the command.
Automatic merge failed; fix conflicts and then commit the result.
# Resolve conflicts
% rm website/aws.erb
% git add website/aws.erb
% git merge --continue
[f-amplify-app 8f610bbf2] Merge remote-tracking branch 'k24d/f-amplify-app' into f-amplify-app
I'm not sure if this is the right way to resolve the conflict.
Fixed all the issues raised in automated comment for #11928
https://github.com/hashicorp/terraform-provider-aws/pull/15966
@k24d @Gowiem @bflad let me know what's the next step to get this moving
@ashishmohite Thanks! We just need to wait for the first view and feedbacks.
Once the PR for the aws_amplify_app
resource has been accepted, we also need to update other resources, which I submited before:
Most helpful comment
I opened the following PRs: