diff --git a/aws/resource_aws_glue_connection.go b/aws/resource_aws_glue_connection.go index a6c378149b1..6fc70758f76 100644 --- a/aws/resource_aws_glue_connection.go +++ b/aws/resource_aws_glue_connection.go @@ -40,6 +40,7 @@ func resourceAwsGlueConnection() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ glue.ConnectionTypeJdbc, glue.ConnectionTypeSftp, + glue.ConnectionTypeMongodb, }, false), }, "description": { diff --git a/aws/resource_aws_glue_connection_test.go b/aws/resource_aws_glue_connection_test.go index 8e31285c107..7c1e1aea33d 100644 --- a/aws/resource_aws_glue_connection_test.go +++ b/aws/resource_aws_glue_connection_test.go @@ -89,6 +89,39 @@ func TestAccAWSGlueConnection_Basic(t *testing.T) { }) } +func TestAccAWSGlueConnection_MongoDB(t *testing.T) { + var connection glue.Connection + + rName := fmt.Sprintf("tf-acc-test-%s", acctest.RandString(5)) + resourceName := "aws_glue_connection.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSGlueConnectionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSGlueConnectionConfig_MongoDB(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSGlueConnectionExists(resourceName, &connection), + resource.TestCheckResourceAttr(resourceName, "connection_properties.%", "3"), + resource.TestCheckResourceAttr(resourceName, "connection_properties.CONNECTION_URL", "mongodb://testdb.com:27017/databasename"), + resource.TestCheckResourceAttr(resourceName, "connection_properties.USERNAME", "testusername"), + resource.TestCheckResourceAttr(resourceName, "connection_properties.PASSWORD", "testpassword"), + resource.TestCheckResourceAttr(resourceName, "connection_type", "MONGODB"), + resource.TestCheckResourceAttr(resourceName, "match_criteria.#", "0"), + resource.TestCheckResourceAttr(resourceName, "physical_connection_requirements.#", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAWSGlueConnection_Description(t *testing.T) { var connection glue.Connection @@ -439,3 +472,19 @@ resource "aws_glue_connection" "test" { } `, rName) } + +func testAccAWSGlueConnectionConfig_MongoDB(rName string) string { + return fmt.Sprintf(` +resource "aws_glue_connection" "test" { + connection_properties = { + CONNECTION_URL = "mongodb://testdb.com:27017/databasename" + PASSWORD = "testpassword" + USERNAME = "testusername" + } + + connection_type = "MONGODB" + + name = "%s" +} +`, rName) +} diff --git a/website/docs/r/glue_connection.html.markdown b/website/docs/r/glue_connection.html.markdown index cc215a2f059..4307a29f274 100644 --- a/website/docs/r/glue_connection.html.markdown +++ b/website/docs/r/glue_connection.html.markdown @@ -54,7 +54,7 @@ The following arguments are supported: * `catalog_id` – (Optional) The ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. * `connection_properties` – (Required) A map of key-value pairs used as parameters for this connection. -* `connection_type` – (Optional) The type of the connection. Defaults to `JBDC`. +* `connection_type` – (Optional) The type of the connection. Supported are: `JDBC`, `MONGODB`. Defaults to `JBDC`. * `description` – (Optional) Description of the connection. * `match_criteria` – (Optional) A list of criteria that can be used in selecting this connection. * `name` – (Required) The name of the connection.