Skip to content

Commit

Permalink
INTMDB-371: PrivateLink Endpoint Timeout (#841)
Browse files Browse the repository at this point in the history
* Updated privatelink_endpoint CD endpoints to match refresh func timeout

* Using Configured timeout times in refresh func

* Updated docs to contain timeout instructions

* Corrected default timeout value on privatelink_endpoint

* Moved the timeout documentation to the resource

* PrivateLink Endpoint documentation refers to the proper resource and includes an example

* Fixed casing on Private Endpoint

* Added to docs on how to learn more about timeouts
  • Loading branch information
evertsd authored Sep 15, 2022
1 parent f4a6c15 commit fcd41b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions mongodbatlas/resource_mongodbatlas_privatelink_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func resourceMongoDBAtlasPrivateLinkEndpoint() *schema.Resource {
},
},
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(1 * time.Hour),
Delete: schema.DefaultTimeout(1 * time.Hour),
},
}
}

Expand All @@ -128,7 +132,7 @@ func resourceMongoDBAtlasPrivateLinkEndpointCreate(ctx context.Context, d *schem
Pending: []string{"INITIATING", "DELETING"},
Target: []string{"WAITING_FOR_USER", "FAILED", "DELETED", "AVAILABLE"},
Refresh: resourcePrivateLinkEndpointRefreshFunc(ctx, conn, projectID, providerName, privateEndpointConn.ID),
Timeout: 1 * time.Hour,
Timeout: d.Timeout(schema.TimeoutCreate),
MinTimeout: 5 * time.Second,
Delay: 3 * time.Second,
}
Expand Down Expand Up @@ -246,7 +250,7 @@ func resourceMongoDBAtlasPrivateLinkEndpointDelete(ctx context.Context, d *schem
Pending: []string{"DELETING"},
Target: []string{"DELETED", "FAILED"},
Refresh: resourcePrivateLinkEndpointRefreshFunc(ctx, conn, projectID, providerName, privateLinkID),
Timeout: 1 * time.Hour,
Timeout: d.Timeout(schema.TimeoutDelete),
MinTimeout: 5 * time.Second,
Delay: 3 * time.Second,
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/privatelink_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ In addition to all arguments above, the following attributes are exported:
* `private_link_service_resource_id` - Resource ID of the Azure Private Link Service that Atlas manages.
* `endpoint_group_names` - GCP network endpoint groups corresponding to the Private Service Connect endpoint service.
* `region_name` - GCP region for the Private Service Connect endpoint service.
* `service_attachment_names` - Unique alphanumeric and special character strings that identify the service attachments associated with the GCP Private Service Connect endpoint service.
* `service_attachment_names` - Unique alphanumeric and special character strings that identify the service attachments associated with the GCP Private Service Connect endpoint service.

See [MongoDB Atlas API](https://docs.atlas.mongodb.com/reference/api/private-endpoints-service-get-one/) Documentation for more information.
6 changes: 6 additions & 0 deletions website/docs/r/privatelink_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ resource "mongodbatlas_privatelink_endpoint" "test" {
project_id = "<PROJECT-ID>"
provider_name = "AWS/AZURE"
region = "US_EAST_1"
timeouts {
create = "30m"
delete = "20m"
}
}
```

Expand All @@ -35,6 +40,7 @@ resource "mongodbatlas_privatelink_endpoint" "test" {
* `provider_name` - (Required) Name of the cloud provider for which you want to create the private endpoint service. Atlas accepts `AWS`, `AZURE` or `GCP`.
* `region` - (Required) Cloud provider region in which you want to create the private endpoint connection.
Accepted values are: [AWS regions](https://docs.atlas.mongodb.com/reference/amazon-aws/#amazon-aws), [AZURE regions](https://docs.atlas.mongodb.com/reference/microsoft-azure/#microsoft-azure) and [GCP regions](https://docs.atlas.mongodb.com/reference/google-gcp/#std-label-google-gcp)
* `timeouts`- (Optional) The duration of time to wait for Private Endpoint to be created or deleted. The timeout value is definded by a signed sequence of decimal numbers with an time unit suffix such as: `1h45m`, `300s`, `10m`, .... The valid time units are: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. The default timeout for Private Endpoint create & delete is `1h`. Learn more about timeouts [here](https://www.terraform.io/plugin/sdkv2/resources/retries-and-customizable-timeouts).


## Attributes Reference
Expand Down

0 comments on commit fcd41b9

Please sign in to comment.