You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Service should be created, as described in the kubernetes service documentation.
Extract
An ExternalName service is a special case of service that does not have selectors. It does not define any ports or endpoints. Rather, it serves as a way to return an alias to an external service residing outside the cluster.
When looking up the host my-service.prod.svc.CLUSTER, the cluster DNS service will return a CNAME record with the value my.database.example.com. Accessing such a service works in the same way as others, with the only difference that the redirection happens at the DNS level and no proxying or forwarding occurs. Should you later decide to move your database into your cluster, you can start its pods, add appropriate selectors or endpoints and change the service type.
Actual Behavior
Terraform throws an error.
1 error(s) occurred:
* kubernetes_service.my_external_name: "spec.0.port": required field is not set
If you set the port, it will then say you need to set target_port
Setting both of these will work, and the service will be created. The service does work as expected...
but I also created a service with out using terraform and ports were not required.
leviisbomb made with terraform forcing me to set the ports.
my-service made manually with out terraform.
Steps to Reproduce
Try to create a Kubernetes Service resource with out defining ports.
terraform apply
Important Factoids
port is required per the terraform documentation but it in this case it is not actually required in kubernetes.
The text was updated successfully, but these errors were encountered:
It seems like a pretty easy fix but sometimes ports are required. Is it up to the user to follow the dependencies from the documenation of that resource?
If I try to execute a service that requires a port, will terraform error when I run plan or will it allow me to run apply and error when kubernetes rejects it?
@shadycuz We don't have any good mechanisms to express conditional requirements (field being Required under some conditions) at this point in the core schema, so we just fall back to the API validation there.
The only caveat is that the failure will be raised during apply, not plan.
Terraform Version
levi@La-Tower:~$ terraform -v
Terraform v0.9.11
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/shadycuz/507fbd614b43aacd6a5a46edfbbfc834#file-gistfile1-txt
Expected Behavior
Service should be created, as described in the kubernetes service documentation.
Extract
Actual Behavior
Terraform throws an error.
If you set the port, it will then say you need to set target_port
Setting both of these will work, and the service will be created. The service does work as expected...
but I also created a service with out using terraform and ports were not required.
leviisbomb made with terraform forcing me to set the ports.
my-service made manually with out terraform.
Steps to Reproduce
Try to create a Kubernetes Service resource with out defining ports.
terraform apply
Important Factoids
port is required per the terraform documentation but it in this case it is not actually required in kubernetes.
The text was updated successfully, but these errors were encountered: