Domain base for twilio_serverless_service
Closed this issue · 4 comments
Missing attribute for serverless service
Hi Rob, thanks for the provider!
I'm working on setting up Twilio infrastructure for our project using your provider. I need to create TwiML App with Voice URL pointing to Twilio Serverless Function. For this I need to know domainBase
property for the service, which is used to construct URL for the function. I couldn't find this property in exported attributes for twilio_serverless_service
.
Would it be possible to update that resource so the domainBase
is exported?
Describe the solution you'd like
- exported attribute
domain_base
so it can be used as an output
output "service_domain_base" {
description = "The domain base of the Twilio service."
value = twilio_serverless_service.service.domain_base
}
Additional context
n/a
Hi @kamilbonna,
Thanks for using the provider. I will look at adding the missing attribute.
As this appears to be a new attribute there is another way you can construct a function url, you can concatenate the environment domain_name attribute and the function path attribute together. Then prefix this value with https://
i.e.
"https://${twilio_serverless_environment.environment.domain_name}${twilio_serverless_function.function.path}"
.
The complete example can be seen at #23 (comment)
I will look at adding the missing attribute regardless but this might be a better solution as it should take into account any domain suffixes that are applied to the environment.
Kind Regards
Rob
Hi @RJPearson94,
thank you for that! As I was focused on service and deployment resources, I've completely missed that I can get the domain_name
attribute from the twilio_serverless_environment
resource. That's all I needed for my use case. Feel free to close the issue if needed.
Best Regards,
Kamil
Hi @kamilbonna,
No problem, I will have a think about if there is a better way to document this, as it is very easily missed and the Twilio console abstracts away/ hides this from you.
I will leave the issue open for now, as I do want to add the missing attribute, as there may be use cases for just having the domain base
Kind Regards
Rob
domain_base has been added as an attribute to the twilio_serverless_service
resource and data source. This has been released as part of 0.23.0 of the terraform provider.
To use this new attribute, please add the following Terraform code
terraform {
required_providers {
twilio = {
source = "RJPearson94/twilio"
version = ">= 0.23.0"
}
}
}
Kind Regards
Rob