Skip to content

Conversation

@mwstobo
Copy link
Contributor

@mwstobo mwstobo commented Sep 11, 2025

This commit implements custom domain names for an egress private endpoint as a Terraform resource. See below for official Cockroach Cloud documentation for the feature. This feature is currently in limited access and is not yet available to all customers.

This resource is separate from the existing egress private endpoint resource for sequencing reasons: in order for domain names to be successfully added to an egress private endpoint, the endpoint must be in the AVAILABLE state. However, it is possible that other resources might be needed to make the endpoint AVAILABLE. Therefore, we have two resources, to allow Terraform to create one separately from the other.

https://www.cockroachlabs.com/docs/cockroachcloud/egress-private-endpoints.html

This PR is waiting for two things:

  • Newly renamed UpdateEgressPrivateEndpoint
  • Domain names state field to be added to the response model

Commit checklist

  • Changelog
  • Doc gen (make generate)
  • Integration test(s)
  • Acceptance test(s)
  • Example(s)

@mwstobo mwstobo force-pushed the egress-private-endpoint-domain-names branch from 702f294 to 2aaa768 Compare September 11, 2025 18:27
@mwstobo mwstobo force-pushed the egress-private-endpoint-domain-names branch from 2aaa768 to 25e65c3 Compare October 2, 2025 16:39
@mwstobo mwstobo marked this pull request as ready for review October 2, 2025 16:39
@mwstobo mwstobo requested review from chenbh, fantapop and jhlodin October 2, 2025 16:39
@mwstobo mwstobo force-pushed the egress-private-endpoint-domain-names branch 2 times, most recently from 7658e8d to fc98588 Compare October 2, 2025 16:48
Copy link

@jhlodin jhlodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor docs suggestions, otherwise LGTM

### Required

- `cluster_id` (String) cluster_id identifies the cluster to which this egress private endpoint applies
- `domain_names` (List of String) domain_names are the domain names to associate with the egress private endpoint.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `domain_names` (List of String) domain_names are the domain names to associate with the egress private endpoint.
- `domain_names` (List of Strings) domain_names contains a list of domain names to associate with the egress private endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List of String is auto generated, so I can't change it. I've made the suggested wording change though!

@mwstobo mwstobo force-pushed the egress-private-endpoint-domain-names branch 2 times, most recently from bec53cf to 77eb382 Compare October 2, 2025 17:30
Copy link
Collaborator

@fantapop fantapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is all looking good to me here. I was wondering why we need a separate resource for this? It seems like we could just add the domain_names list to the cockroach_egress_private_endpoint resource. If there is a reason we should probably document it somewhere. Maybe just the commit message.

@mwstobo
Copy link
Contributor Author

mwstobo commented Oct 22, 2025

Good question! The expected use case for this feature includes a bit of sequencing:

  • Create a cockroach_egress_private_endpoint in CC using a target_service_identifier from another, non-CC resource. The endpoint will be created in the PENDING state.
  • Create a non-CC resource using outputs from the cockroach_egress_private_endpoint. This resource will allow the endpoint to move into the AVAILABLE state.
  • Create a cockroach_egress_private_endpoint_domain_names resource. Domain names can only be set up once the endpoint is AVAILABLE.

If domain names were configured in cockroach_egress_private_endpoint, we would never be able to create the second resource needed to move the endpoint into the AVAILABLE state, and domain names would never be successfully created.

@mwstobo
Copy link
Contributor Author

mwstobo commented Oct 22, 2025

The example in the docs describes how this works with Confluent Cloud:

resource "confluent_private_link_attachment" "main" {
  cloud        = "AWS"
  region       = "us-east-1"
  display_name = "main-private-link-attachment"
  environment {
    id = confluent_environment.main.id
  }
}

resource "cockroach_egress_private_endpoint" "confluent_cloud" {
  cluster_id                = cockroach_cluster.my_cluster.id
  region                    = "us-east-1"
  target_service_type       = "PRIVATE_SERVICE"
  target_service_identifier = confluent_private_link_attachment.main.aws.vpc_endpoint_service_name
}

resource "confluent_private_link_attachment_connection" "cockroach_cloud" {
  display_name = "cockroach-cloud-access-point"
  environment {
    id = confluent_environment.main.id
  }
  aws {
    vpc_endpoint_id = cockroach_egress_private_endpoint.confluent_cloud.endpoint_connection_id
  }
  private_link_attachment {
    id = confluent_private_link_attachment.main.id
  }
}

resource "cockroach_egress_private_endpoint_domain_names" "confluent_cloud" {
  cluster_id  = cockroach_cluster.my_cluster.id
  endpoint_id = cockroach_egress_private_endpoint.confluent_cloud.id
  domain_names = [
    "*.us-east-1.aws.private.confluent.cloud"
  ]

  depends_on = [
    confluent_private_link_attachment_connection.cockroach_cloud
  ]
}

This commit implements custom domain names for an egress private
endpoint as a Terraform resource. See below for official Cockroach
Cloud documentation for the feature. This feature is currently in
limited access and is not yet available to all customers.

This resource is separate from the existing egress private endpoint
resource for sequencing reasons: in order for domain names to be
successfully added to an egress private endpoint, the endpoint must be
in the AVAILABLE state. However, it is possible that other resources
might be needed to make the endpoint AVAILABLE. Therefore, we have two
resources, to allow Terraform to create one separately from the other.

https://www.cockroachlabs.com/docs/cockroachcloud/egress-private-endpoints.html
@mwstobo mwstobo force-pushed the egress-private-endpoint-domain-names branch from 77eb382 to 7906828 Compare October 22, 2025 20:52
Copy link
Collaborator

@fantapop fantapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perf, thanks for the explanation.

@mwstobo mwstobo merged commit 9086c64 into cockroachdb:main Oct 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants