Skip to content

Commit 1f0e5ac

Browse files
nkvuongalexott
andauthored
[Feature] Add AWS support for databricks_mws_ncc_private_endpoint_rule (#4804)
## Changes - Add documentation and tests for `databricks_mws_ncc_private_endpoint_rule` on AWS. Resolve #4685 ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] relevant change in `docs/` folder - [x] covered with integration tests in `internal/acceptance` - [x] using Go SDK --------- Co-authored-by: Alex Ott <[email protected]>
1 parent 4e6b4ae commit 1f0e5ac

File tree

4 files changed

+67
-8
lines changed

4 files changed

+67
-8
lines changed

NEXT_CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
### Breaking Changes
66

77
### New Features and Improvements
8+
9+
10+
* Add AWS support for `databricks_mws_ncc_private_endpoint_rule` ([#4804](https://github.com/databricks/terraform-provider-databricks/pull/4804)).
811
* Added `key` argument to `databricks_jobs` data source to enable mapping by job ID and allow duplicate job names ([#4796](https://github.com/databricks/terraform-provider-databricks/pull/4796)).
912

1013
### Bug Fixes
1114

1215
### Documentation
13-
* Added link to Workload Identity Federation page ([#4786](https://github.com/databricks/terraform-provider-databricks/pull/4786)).
1416

17+
* Added link to Workload Identity Federation page ([#4786](https://github.com/databricks/terraform-provider-databricks/pull/4786)).
1518
* auto `zone_id` can only be used for fleet node types in `databricks_instance_pool` resource ([#4782](https://github.com/databricks/terraform-provider-databricks/pull/4782)).
1619
* Document `tags` attribute in `databricks_pipeline` resource ([#4783](https://github.com/databricks/terraform-provider-databricks/pull/4783)).
17-
1820
* Recommend OAuth instead of PAT in guides ([#4787](https://github.com/databricks/terraform-provider-databricks/pull/4787))
1921
* Document new options in `databricks_model_serving` resource ([#4789](https://github.com/databricks/terraform-provider-databricks/pull/4789))
2022

docs/resources/mws_ncc_private_endpoint_rule.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ Allows you to create a private endpoint in a [Network Connectivity Config](mws_n
77

88
-> This resource can only be used with an account-level provider!
99

10-
-> This feature is only available in Azure.
10+
-> This feature is available on Azure, and in Public Preview on AWS.
1111

1212
## Example Usage
1313

14+
Create a private endpoint to an Azure storage account
15+
1416
```hcl
1517
variable "region" {}
1618
variable "prefix" {}
@@ -29,13 +31,42 @@ resource "databricks_mws_ncc_private_endpoint_rule" "storage" {
2931
}
3032
```
3133

34+
Create a private endpoint rule to an AWS VPC endpoint and to an S3 bucket
35+
36+
```hcl
37+
variable "region" {}
38+
variable "prefix" {}
39+
40+
resource "databricks_mws_network_connectivity_config" "ncc" {
41+
provider = databricks.account
42+
name = "ncc-for-${var.prefix}"
43+
region = var.region
44+
}
45+
46+
resource "databricks_mws_ncc_private_endpoint_rule" "storage" {
47+
provider = databricks.account
48+
network_connectivity_config_id = databricks_mws_network_connectivity_config.ncc.network_connectivity_config_id
49+
resource_names = ["bucket"]
50+
}
51+
52+
resource "databricks_mws_ncc_private_endpoint_rule" "vpce" {
53+
provider = databricks.account
54+
network_connectivity_config_id = databricks_mws_network_connectivity_config.ncc.network_connectivity_config_id
55+
endpoint_service = "com.amazonaws.vpce.us-west-2.vpce-svc-xyz"
56+
domain_names = ["subdomain.internal.net"]
57+
}
58+
```
59+
3260
## Argument Reference
3361

3462
The following arguments are available:
3563

3664
* `network_connectivity_config_id` - Canonical unique identifier of Network Connectivity Config in Databricks Account. Change forces creation of a new resource.
37-
* `resource_id` - The Azure resource ID of the target resource. Change forces creation of a new resource.
38-
* `group_id` - The sub-resource type (group ID) of the target resource. Must be one of supported resource types (i.e., `blob`, `dfs`, `sqlServer` , etc. Consult the [Azure documentation](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview#private-link-resource) for full list of supported resources). Note that to connect to workspace root storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`. Change forces creation of a new resource.
65+
* `resource_id` - (Azure only) The Azure resource ID of the target resource. Change forces creation of a new resource.
66+
* `group_id` - (Azure only) The sub-resource type (group ID) of the target resource. Must be one of supported resource types (i.e., `blob`, `dfs`, `sqlServer` , etc. Consult the [Azure documentation](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview#private-link-resource) for full list of supported resources). Note that to connect to workspace root storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`. Change forces creation of a new resource.
67+
* `domain_names` - (AWS only) Only used by private endpoints towards a VPC endpoint service behind a customer-managed VPC endpoint service. List of target AWS resource FQDNs accessible via the VPC endpoint service. Conflicts with `resource_names`.
68+
* `endpoint_service` - (AWS only) Example `com.amazonaws.vpce.us-east-1.vpce-svc-123abcc1298abc123`. The full target AWS endpoint service name that connects to the destination resources of the private endpoint.
69+
* `resource_names` - (AWS only) Only used by private endpoints towards AWS S3 service. List of globally unique S3 bucket names that will be accessed via the VPC endpoint. The bucket names must be in the same region as the NCC/endpoint service. Conflict with `domain_names`.
3970

4071
## Attribute Reference
4172

@@ -53,6 +84,8 @@ The possible values are:
5384
* `deactivated_at` - Time in epoch milliseconds when this object was deactivated.
5485
* `creation_time` - Time in epoch milliseconds when this object was created.
5586
* `updated_time` - Time in epoch milliseconds when this object was updated.
87+
* `enabled` - Activation status. Only used by private endpoints towards an AWS S3 service.
88+
* `vpc_endpoint_id` - The AWS VPC endpoint ID. You can use this ID to identify the VPC endpoint created by Databricks.
5689

5790
## Import
5891

mws/mws_network_connectivity_config_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ func TestMwsAccNetworkConnectivityConfig(t *testing.T) {
4444
name = "tf-{var.RANDOM}"
4545
region = "{env.AWS_REGION}"
4646
}
47+
48+
resource "databricks_mws_ncc_private_endpoint_rule" "this" {
49+
network_connectivity_config_id = databricks_mws_network_connectivity_config.this.network_connectivity_config_id
50+
resource_names = ["{env.TEST_LOGDELIVERY_BUCKET}"]
51+
}
4752
`,
4853
}, acceptance.Step{
4954
Template: `
@@ -52,6 +57,11 @@ func TestMwsAccNetworkConnectivityConfig(t *testing.T) {
5257
name = "tf-{var.RANDOM}"
5358
region = "{env.AWS_REGION}"
5459
}
60+
61+
resource "databricks_mws_ncc_private_endpoint_rule" "this" {
62+
network_connectivity_config_id = databricks_mws_network_connectivity_config.this.network_connectivity_config_id
63+
resource_names = ["{env.TEST_LOGDELIVERY_BUCKET}"]
64+
}
5565
`,
5666
})
5767
}

mws/resource_mws_ncc_private_endpoint_rule.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@ import (
1111

1212
func ResourceMwsNccPrivateEndpointRule() common.Resource {
1313
s := common.StructToSchema(settings.NccPrivateEndpointRule{}, func(m map[string]*schema.Schema) map[string]*schema.Schema {
14-
for _, p := range []string{"network_connectivity_config_id", "group_id", "resource_id"} {
15-
common.CustomizeSchemaPath(m, p).SetRequired().SetForceNew()
14+
for _, p := range []string{"endpoint_service", "group_id", "resource_id"} {
15+
common.CustomizeSchemaPath(m, p).SetForceNew()
1616
}
17-
for _, p := range []string{"rule_id", "endpoint_name", "connection_state", "creation_time", "updated_time"} {
17+
for _, p := range []string{"rule_id", "endpoint_name", "connection_state", "creation_time", "updated_time", "vpc_endpoint_id"} {
1818
common.CustomizeSchemaPath(m, p).SetComputed()
1919
}
20+
21+
common.CustomizeSchemaPath(m, "network_connectivity_config_id").SetRequired().SetForceNew()
22+
common.CustomizeSchemaPath(m, "enabled").SetOptional().SetComputed()
23+
24+
supportedFields := []string{"group_id", "resource_names", "domain_names"}
25+
for _, key := range supportedFields {
26+
conflicts := make([]string, 0, len(supportedFields)-1)
27+
for _, otherKey := range supportedFields {
28+
if key != otherKey {
29+
conflicts = append(conflicts, otherKey)
30+
}
31+
}
32+
common.CustomizeSchemaPath(m, key).SetConflictsWith(conflicts)
33+
}
2034
return m
2135
})
2236
p := common.NewPairSeparatedID("network_connectivity_config_id", "rule_id", "/")

0 commit comments

Comments
 (0)