|
1 | 1 | // |
2 | 2 | // DISCLAIMER |
3 | 3 | // |
4 | | -// Copyright 2022 ArangoDB GmbH, Cologne, Germany |
| 4 | +// Copyright 2022-2023 ArangoDB GmbH, Cologne, Germany |
5 | 5 | // |
6 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | // you may not use this file except in compliance with the License. |
@@ -33,10 +33,11 @@ import ( |
33 | 33 |
|
34 | 34 | const ( |
35 | 35 | // Private Endpoint field names |
36 | | - privateEndpointNameFieldName = "name" |
37 | | - privateEndpointDescriptionFieldName = "description" |
38 | | - privateEndpointDeploymentFieldName = "deployment" |
39 | | - privateEndpointDNSNamesFieldName = "dns_names" |
| 36 | + privateEndpointNameFieldName = "name" |
| 37 | + privateEndpointDescriptionFieldName = "description" |
| 38 | + privateEndpointDeploymentFieldName = "deployment" |
| 39 | + prirvateEndpointEnablePrivateDNSFieldName = "enable_private_dns" |
| 40 | + privateEndpointDNSNamesFieldName = "dns_names" |
40 | 41 |
|
41 | 42 | // AKS field names |
42 | 43 | privateEndpointAKSFieldName = "aks" |
@@ -79,6 +80,11 @@ func resourcePrivateEndpoint() *schema.Resource { |
79 | 80 | Description: "Private Endpoint Resource Private Endpoint Deployment ID field", |
80 | 81 | Required: true, |
81 | 82 | }, |
| 83 | + prirvateEndpointEnablePrivateDNSFieldName: { |
| 84 | + Type: schema.TypeBool, |
| 85 | + Description: "Private Endpoint Resource Private Endpoint Enable Private DNS field", |
| 86 | + Optional: true, |
| 87 | + }, |
82 | 88 | privateEndpointDNSNamesFieldName: { |
83 | 89 | Type: schema.TypeList, |
84 | 90 | Description: "Private Endpoint Resource Private Endpoint DNS Names field (list of dns names)", |
@@ -200,13 +206,14 @@ func resourcePrivateEndpointRead(ctx context.Context, d *schema.ResourceData, m |
200 | 206 | // flattenPrivateEndpointResource will take a Private Endpoint object and turn it into a flat map for terraform digestion. |
201 | 207 | func flattenPrivateEndpointResource(privateEndpoint *network.PrivateEndpointService) map[string]interface{} { |
202 | 208 | return map[string]interface{}{ |
203 | | - privateEndpointNameFieldName: privateEndpoint.GetName(), |
204 | | - privateEndpointDescriptionFieldName: privateEndpoint.GetDescription(), |
205 | | - privateEndpointDeploymentFieldName: privateEndpoint.GetDeploymentId(), |
206 | | - privateEndpointDNSNamesFieldName: privateEndpoint.GetAlternateDnsNames(), |
207 | | - privateEndpointAKSFieldName: flattenAKSResource(privateEndpoint.GetAks()), |
208 | | - privateEndpointAWSFieldName: flattenAWSResource(privateEndpoint.GetAws()), |
209 | | - privateEndpointGCPFieldName: flattenGCPResource(privateEndpoint.GetGcp()), |
| 209 | + privateEndpointNameFieldName: privateEndpoint.GetName(), |
| 210 | + privateEndpointDescriptionFieldName: privateEndpoint.GetDescription(), |
| 211 | + privateEndpointDeploymentFieldName: privateEndpoint.GetDeploymentId(), |
| 212 | + prirvateEndpointEnablePrivateDNSFieldName: privateEndpoint.GetEnablePrivateDns(), |
| 213 | + privateEndpointDNSNamesFieldName: privateEndpoint.GetAlternateDnsNames(), |
| 214 | + privateEndpointAKSFieldName: flattenAKSResource(privateEndpoint.GetAks()), |
| 215 | + privateEndpointAWSFieldName: flattenAWSResource(privateEndpoint.GetAws()), |
| 216 | + privateEndpointGCPFieldName: flattenGCPResource(privateEndpoint.GetGcp()), |
210 | 217 | } |
211 | 218 | } |
212 | 219 |
|
@@ -308,6 +315,9 @@ func expandPrivateEndpointResource(d *schema.ResourceData) (*network.PrivateEndp |
308 | 315 | } else { |
309 | 316 | return nil, fmt.Errorf("unable to find parse field %s", privateEndpointDeploymentFieldName) |
310 | 317 | } |
| 318 | + if v, ok := d.GetOk(prirvateEndpointEnablePrivateDNSFieldName); ok { |
| 319 | + ret.EnablePrivateDns = v.(bool) |
| 320 | + } |
311 | 321 | if v, ok := d.GetOk(privateEndpointDNSNamesFieldName); ok { |
312 | 322 | dnsNames, err := expandPrivateEndpointStringList(v.([]interface{})) |
313 | 323 | if err != nil { |
@@ -455,6 +465,9 @@ func resourcePrivateEndpointUpdate(ctx context.Context, d *schema.ResourceData, |
455 | 465 | if d.HasChange(privateEndpointDescriptionFieldName) { |
456 | 466 | privateEndpoint.Description = d.Get(privateEndpointDescriptionFieldName).(string) |
457 | 467 | } |
| 468 | + if d.HasChange(prirvateEndpointEnablePrivateDNSFieldName) { |
| 469 | + privateEndpoint.EnablePrivateDns = d.Get(prirvateEndpointEnablePrivateDNSFieldName).(bool) |
| 470 | + } |
458 | 471 | if d.HasChange(privateEndpointDNSNamesFieldName) { |
459 | 472 | dnsNames, err := expandPrivateEndpointStringList(d.Get(privateEndpointDNSNamesFieldName).([]interface{})) |
460 | 473 | if err != nil { |
|
0 commit comments