Report an error if azd infra synth is used and the model is out of sync with the manifests
If you run azd infra synth and then you update the app model code, it's ignore when running azd commands (provision/up/deploy). This can be really confusing and we should do extra work here to let the user know that they are out of sync.
@vhvb1989 chatted about this a bit. I think there are a few things we can do here:
-
When using files instead of what we would generate via talking to the AppHost, print some info level messages in our output saying what's going on, so it's clearer from a console log what happened instead of having to dig into the output of
--debugand hope we wrote a debug message. We can do this quickly today. We should also consider writing comments at the top of the files generated byinfra synththat says they were generated byazd infra synthso readers understand what's going on. -
We could compute a hash of the manifest + all the referenced bicep files and burn that into our generated files. Then, when using them, compute the hash and ensure they match. If they don't, issue a warning that lets the user know "you modified the AppHost since you've run infra synth and the changes will not be reflected". For the hash, I suspect that the manifest + the linked bicep files is sufficient to give us a cache key. We may want to do some level of normalization (maybe just
\r\n->\ngiven that this will likely be common in mixed Linux/Windows cases) to ensure the hash is stable against non-semantic changes, but it feels like a place we need to be careful to avoid boiling the oceans.