Skip to content

Commit ff6959e

Browse files
authored
Merge pull request #1255 from duplocloud/hotfix/0.11.29
Hotfix Release v0.11.29
2 parents ea202a4 + 4668bcc commit ff6959e

33 files changed

+190
-60
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NAMESPACE=duplocloud
88

99
NAME=duplocloud
1010
BINARY=terraform-provider-${NAME}
11-
VERSION=0.11.28
11+
VERSION=0.11.29
1212
#mac
1313
#OS_ARCH=darwin_amd64
1414
#OS_ARCH=linux_amd64

docs/data-sources/duplo_service_lbconfigs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Read-Only:
5353
- `cloud_name` (String)
5454
- `custom_cidr` (List of String)
5555
- `dns_name` (String)
56+
- `eip_allocations` (List of String)
5657
- `external_port` (Number)
5758
- `external_traffic_policy` (String)
5859
- `extra_selector_label` (List of Object) (see [below for nested schema](#nestedobjatt--services--lbconfigs--extra_selector_label))

docs/resources/azure_vm_maintenance_configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ resource "duplocloud_azure_vm_maintenance_configuration" "mt" {
2525
window {
2626
start_time = "2024-11-12 00:00"
2727
expiration_time = "2024-11-19 00:00"
28-
duration = "06:00"
28+
duration = "02:00"
2929
recur_every = "1Month day1,day2,day3,day4,day5,day6,day7,day8,day9,day10,day11,day12,day13,day14,day15,day16,day17,day18,day19,day20,day21,day22,day23,day24,day25,day26,day27,day28,day29,day30,day31,day-1"
3030
time_zone = "India Standard Time"
3131
}
@@ -70,7 +70,7 @@ Required:
7070

7171
Optional:
7272

73-
- `duration` (String) The duration of the maintenance window in HH:mm format.
73+
- `duration` (String) The duration of the maintenance window in HH:mm format. Should be less than or equal to 3 Hrs
7474
- `expiration_time` (String) Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format.
7575
- `recur_every` (String) he rate at which a maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules.
7676

docs/resources/duplo_service_lbconfigs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ resource "duplocloud_duplo_service_lbconfigs" "myservice2" {
7575
}
7676
}
7777
}
78+
79+
//Example to attach elastic ips to public NLB
80+
resource "duplocloud_duplo_service_lbconfigs" "myservice" {
81+
tenant_id = "b4315a73-6455-4e99-8e26-7a771018cc1e"
82+
replication_controller_name = "nlb-docker"
83+
84+
lbconfigs {
85+
external_port = 443
86+
is_native = false
87+
lb_type = 6
88+
port = "3027"
89+
protocol = "tcp"
90+
is_internal = false
91+
eip_allocations = ["eipalloc-0448f756b404093cb", "eipalloc-0b700a23ac3f2522d"]
92+
}
93+
94+
}
7895
```
7996

8097
<!-- schema generated by tfplugindocs -->
@@ -131,6 +148,9 @@ Optional:
131148
- `backend_protocol_version` (String) Is used for communication between the load balancer and the target instances. This field is used to set protocol version for ALB load balancer. Only applicable when protocol is HTTP or HTTPS. The protocol version. Specify GRPC to send requests to targets using gRPC. Specify HTTP2 to send requests to targets using HTTP/2. The default is HTTP1, which sends requests to targets using HTTP/1.1
132149
- `certificate_arn` (String) The ARN of an ACM certificate to associate with this load balancer. Only applicable for HTTPS.
133150
- `custom_cidr` (List of String) Specify CIDR Values. This is applicable only for Network Load Balancer if `lb_type` is `6`.
151+
- `eip_allocations` (List of String) Allocate Elastic IP to load balancer, which is configured under plan configuration.
152+
153+
Note: This field can only be set for non internal lbtype NLB(6)
134154
- `external_port` (Number) The frontend port associated with this load balancer configuration. Required if `lb_type` is not `7`.
135155
- `external_traffic_policy` (String) Only for K8S Node Port (`lb_type = 4`) or load balancers in Kubernetes. Set the kubernetes service `externalTrafficPolicy` attribute.
136156
- `extra_selector_label` (Block List) Only for K8S services or load balancers in Kubernetes. Sets an additional selector label to narrow which pods can receive traffic. (see [below for nested schema](#nestedblock--lbconfigs--extra_selector_label))

docs/resources/tenant_network_security_rule.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,16 @@ Import is supported using the following syntax:
7676
```shell
7777
# Example 1: Importing a "source_tenant" rule:
7878
# - TENANT_ID is the target tenant GUID
79-
# - TYPE SG rule type integer value Tenant SG = 0 IP Address SG = 1
80-
# - SOURCE_TENANT for type 0, this is the source tenant name
81-
# - SOURCE_ADDRESS for TYPE = 1, this is the source IP address or CIDR block, format 10.220.32.192-32.
79+
# - TYPE (0/1) : If the source in the Duplo portal is a tenant name, represent the TYPE as 0. If the source is an IP address, represent the TYPE as 1.
80+
# - SOURCE_TENANT : Name of security group's source tenant
81+
# - SOURCE_ADDRESS IP address or CIDR block, format 10.220.32.192-32.
8282
# - PROTOCOL is the protocol (tcp, udp, icmp)
8383
# - FROM_PORT is the starting port (0-65535)
8484
# - TO_PORT is the ending port (0-65535)
8585
terraform import duplocloud_tenant_network_security_rule.myrule *TENANT_ID*/*TYPE*/*SOURCE_TENANT*/*PROTOCOL*/*FROM_PORT*/*TO_PORT*
86+
#Example : terraform import duplocloud_tenant_network_security_rule.myrule {GUID}/0/abc/tcp/443/443
87+
8688

8789
terraform import duplocloud_tenant_network_security_rule.myrule *TENANT_ID*/*TYPE*/*SOURCE_ADDRESS*/*PROTOCOL*/*FROM_PORT*/*TO_PORT*
90+
#Example : terraform import duplocloud_tenant_network_security_rule.myrule {GUID}/1/10.34.0.1-32/tcp/443/443
8891
```

duplocloud/data_source_duplo_ecs_task_definition.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package duplocloud
33
import (
44
"context"
55
"fmt"
6-
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
76
"log"
87

8+
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
9+
910
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1011
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1112
)
@@ -50,9 +51,18 @@ func dataSourceDuploEcsTaskDefinitionRead(ctx context.Context, d *schema.Resourc
5051
return diag.Errorf("Unable to read tenant %s ECS task definition '%s': not found", tenantID, arn)
5152
}
5253
d.SetId(fmt.Sprintf("%s/%s", tenantID, arn))
54+
tenant, cerr := c.TenantGetV2(tenantID)
55+
if cerr != nil {
56+
if cerr.Status() == 404 {
57+
log.Printf("Tenant %s not found", tenantID)
58+
d.SetId("")
59+
return nil
60+
}
61+
return diag.Errorf("Duplocloud resource tenant information'\n%s", err)
62+
}
5363

5464
// Read the object into state
55-
flattenEcsTaskDefinition(duplo, d)
65+
flattenEcsTaskDefinition(duplo, d, tenant.AccountName)
5666

5767
log.Printf("[TRACE] dataSourceDuploEcsTaskDefinitionRead(%s, %s): end", tenantID, arn)
5868
return nil

duplocloud/resource_duplo_aws_cloudfront_distribution.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,22 @@ func expandAwsCloudfrontDistributionDefaultCacheBehavior(m map[string]interface{
11461146
}
11471147

11481148
if m["cache_policy_id"].(string) == "" {
1149-
dcb.MinTTL = m["min_ttl"].(int)
1150-
dcb.MaxTTL = m["max_ttl"].(int)
1151-
dcb.DefaultTTL = m["default_ttl"].(int)
1149+
min := m["min_ttl"]
1150+
if min != nil {
1151+
v := min.(int)
1152+
dcb.MinTTL = &v
1153+
}
1154+
max := m["max_ttl"]
1155+
if max != nil {
1156+
v := max.(int)
1157+
dcb.MaxTTL = &v
1158+
}
1159+
def := m["default_ttl"]
1160+
if def != nil {
1161+
v := def.(int)
1162+
dcb.DefaultTTL = &v
1163+
}
1164+
11521165
}
11531166

11541167
// TODO Handle "trusted_key_groups"

duplocloud/resource_duplo_aws_dynamodb_table_v2.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,10 @@ func shouldUpdateThroughput(
11661166
request *duplosdk.DuploDynamoDBTableRequestV2,
11671167

11681168
) bool {
1169-
if (table.ProvisionedThroughput.ReadCapacityUnits != request.ProvisionedThroughput.ReadCapacityUnits) || (table.ProvisionedThroughput.WriteCapacityUnits != request.ProvisionedThroughput.WriteCapacityUnits) {
1170-
return true
1169+
if table.ProvisionedThroughput != nil && request.ProvisionedThroughput != nil {
1170+
if (table.ProvisionedThroughput.ReadCapacityUnits != request.ProvisionedThroughput.ReadCapacityUnits) || (table.ProvisionedThroughput.WriteCapacityUnits != request.ProvisionedThroughput.WriteCapacityUnits) {
1171+
return true
1172+
}
11711173
}
11721174
return false
11731175
}

duplocloud/resource_duplo_azure_datafactory.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package duplocloud
22

33
import (
44
"context"
5-
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
65
"log"
76
"strings"
87
"time"
98

9+
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
10+
1011
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1112
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1213
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -84,6 +85,7 @@ func resourceAzureDataFactoryRead(ctx context.Context, d *schema.ResourceData, m
8485
if err.Status() == 404 {
8586
log.Printf("[DEBUG] resourceAzureDataFactoryRead: Datafactory %s not found for tenantId %s, removing from state", name, tenantId)
8687
d.SetId("")
88+
return nil
8789
}
8890
return diag.Errorf("Unable to retrieve datafactory details error: %s", err.Error())
8991
}

duplocloud/resource_duplo_azure_log_analytics_workspace.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package duplocloud
33
import (
44
"context"
55
"fmt"
6-
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
76
"log"
87
"strings"
98
"time"
109

10+
"github.com/duplocloud/terraform-provider-duplocloud/duplosdk"
11+
1112
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1213
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1314
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -109,9 +110,14 @@ func resourceAzureLogAnalyticsWorkspaceRead(ctx context.Context, d *schema.Resou
109110
}
110111
return diag.Errorf("Unable to retrieve tenant %s azure Log Analytics Workspace %s : %s", infraName, name, clientErr)
111112
}
113+
if duplo.ID == "" {
114+
log.Printf("[DEBUG] resourceAzureLogAnalyticsWorkspaceRead: Azure Log Analytics Workspace %s not found for tenantId %s, removing from state", name, infraName)
115+
d.SetId("")
112116

117+
}
118+
rgpn := strings.Split(duplo.ID, "/")
113119
d.Set("infra_name", infraName)
114-
d.Set("resource_group_name", strings.Split(duplo.ID, "/")[4])
120+
d.Set("resource_group_name", rgpn[len(rgpn)-1])
115121
d.Set("name", name)
116122
d.Set("azure_id", duplo.ID)
117123
d.Set("sku", duplo.PropertiesSku.Name)
@@ -166,6 +172,25 @@ func resourceAzureLogAnalyticsWorkspaceUpdate(ctx context.Context, d *schema.Res
166172
}
167173

168174
func resourceAzureLogAnalyticsWorkspaceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
175+
id := d.Id()
176+
infraName, name, err := parseAzureLogAnalyticsWorkspaceIdParts(id)
177+
if err != nil {
178+
return diag.FromErr(err)
179+
}
180+
log.Printf("[TRACE] resourceAzureLogAnalyticsWorkspaceRead(%s, %s): start", infraName, name)
181+
182+
c := m.(*duplosdk.Client)
183+
cerr := c.AzureLogAnalyticsWorkspaceCreate(infraName, duplosdk.DuploAzureLogAnalyticsWorkspaceRq{
184+
Name: "",
185+
ResourceGroup: "",
186+
})
187+
if cerr != nil {
188+
if cerr.Status() == 404 {
189+
return nil
190+
}
191+
return diag.Errorf("Error creating tenant %s azure Log Analytics Workspace '%s': %s", infraName, name, err)
192+
}
193+
169194
return nil // Backend doesn't support delete.
170195
}
171196

0 commit comments

Comments
 (0)