-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: allow custom domains to be associated with a deployment #19
base: main
Are you sure you want to change the base?
feat: allow custom domains to be associated with a deployment #19
Conversation
# See the doc of deno_domain resource for the full example of the entire process of domain setup. | ||
|
||
# `depends_on` may be useful to ensure the domain is ready. | ||
depends_on = [deno_certificate_provisioning.example] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't do this, does it still work? I would suspect that the lack of verification for the domain would make it not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deployment <-> custom domain association API checks if the requested domain is owned by the requester; therefore, at least depends_on = [deno_domain_verification.example_domain_verification]
is needed to get successful association. However, waiting on deno_certificate_provisioning
is not a requirement for the association to succeed.
Here I put depends_on = [deno_certificate_provisioning.example]
because deno_certificate_provisioning in turn depends on deno_domain_verification, so we don't need to explicitly specify the grandchild dependency. But this is a documentation, so I'm wondering what information should be mentioned here
Another question, any reason this is on the deployment resource rather than on the domain resource? |
This commit adds a new attribute
domain_ids
todeno_deployment
resource.This attribute is optional. So only when it's present, the resource will make an API call to associate the domain(s) with the deployment.
Also, when a resource is deleted, it will disassociate the domain(s) from the deployment, although the deployment itself will remain untouched since it's immutable.
Closes #12
Initially I thought I would create a new resource like
deno_domain_deployment_association
that manages the association between domain and deployment, but decided not to do that, because this interface might bring a misunderstanding that we can do N to N mapping between deployments and domains; in fact one deployment can have multiple custom domains, but the opposite is not allowed.To avoid this confusion,
deno_deployment
resource can take a list of domain IDs, which clearly reflects the fact that one deployment can have multiple custom domains.One thing that may be concerning is that the domain doesn't get disassociated from the deployment in the scenario like:
deno_deployment
resource, with a custom domain applied (1stterraform apply
here)domain_ids
attribute in the config file (2ndterraform apply
here)In order to address this issue we probably would like to get "get_deployment" API to return the domain IDs associated with the deployment, so that we can figure out what domains are deleted from the config.