Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_dms_endpoint resource engine_name updated with azure-sql-managed-… #28960

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/28960.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_dms_endpoint: Add support for `azure-sql-managed-instance` `engine_name` value
```
2 changes: 2 additions & 0 deletions internal/service/dms/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
engineNameAuroraPostgresqlServerless = "aurora-postgresql-serverless"
engineNameAuroraServerless = "aurora-serverless"
engineNameAzuredb = "azuredb"
engineNameAzureSQLManagedInstance = "azure-sql-managed-instance"
engineNameDB2 = "db2"
engineNameTransfer = "dms-transfer"
engineNameDocDB = "docdb"
Expand Down Expand Up @@ -48,6 +49,7 @@ func engineName_Values() []string {
engineNameAuroraPostgresqlServerless,
engineNameAuroraServerless,
engineNameAzuredb,
engineNameAzureSQLManagedInstance,
engineNameDB2,
engineNameTransfer,
engineNameDocDB,
Expand Down
89 changes: 89 additions & 0 deletions internal/service/dms/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,47 @@ func TestAccDMSEndpoint_db2_basic(t *testing.T) {
})
}

func TestAccDMSEndpoint_azureSQLManagedInstance(t *testing.T) {
ctx := acctest.Context(t)
resourceName := "aws_dms_endpoint.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t) },
ErrorCheck: acctest.ErrorCheck(t, dms.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckEndpointDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccEndpointConfig_azureSQLManagedInstance(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckEndpointExists(ctx, resourceName),
resource.TestCheckResourceAttrSet(resourceName, "endpoint_arn"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"password"},
},
{
Config: testAccEndpointConfig_azureSQLManagedInstanceUpdate(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckEndpointExists(ctx, resourceName),
resource.TestCheckResourceAttr(resourceName, "database_name", "tf-test-dms-db-updated"),
resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"),
resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"),
resource.TestCheckResourceAttr(resourceName, "port", "3342"),
resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"),
resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"),
resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"),
),
},
},
})
}

func TestAccDMSEndpoint_db2_secretID(t *testing.T) {
ctx := acctest.Context(t)
resourceName := "aws_dms_endpoint.test"
Expand Down Expand Up @@ -3635,6 +3676,54 @@ resource "aws_dms_endpoint" "test" {
`, rName)
}

func testAccEndpointConfig_azureSQLManagedInstance(rName string) string {
return fmt.Sprintf(`
resource "aws_dms_endpoint" "test" {
database_name = "tf-test-dms-db"
endpoint_id = %[1]q
endpoint_type = "source"
engine_name = "azure-sql-managed-instance"
extra_connection_attributes = ""
password = "tftest"
port = 3342
server_name = "tftest"
ssl_mode = "none"

tags = {
Name = %[1]q
Update = "to-update"
Remove = "to-remove"
}

username = "tftest"
}
`, rName)
}

func testAccEndpointConfig_azureSQLManagedInstanceUpdate(rName string) string {
return fmt.Sprintf(`
resource "aws_dms_endpoint" "test" {
database_name = "tf-test-dms-db-updated"
endpoint_id = %[1]q
endpoint_type = "source"
engine_name = "azure-sql-managed-instance"
extra_connection_attributes = "extra"
password = "tftestupdate"
port = 3342
server_name = "tftestupdate"
ssl_mode = "none"

tags = {
Name = %[1]q
Update = "updated"
Add = "added"
}

username = "tftestupdate"
}
`, rName)
}

func testAccEndpointConfig_postgresKey(rName string) string {
return fmt.Sprintf(`
resource "aws_kms_key" "test" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/dms_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The following arguments are required:

* `endpoint_id` - (Required) Database endpoint identifier. Identifiers must contain from 1 to 255 alphanumeric characters or hyphens, begin with a letter, contain only ASCII letters, digits, and hyphens, not end with a hyphen, and not contain two consecutive hyphens.
* `endpoint_type` - (Required) Type of endpoint. Valid values are `source`, `target`.
* `engine_name` - (Required) Type of engine for the endpoint. Valid values are `aurora`, `aurora-postgresql`, `azuredb`, `db2`, `docdb`, `dynamodb`, `elasticsearch`, `kafka`, `kinesis`, `mariadb`, `mongodb`, `mysql`, `opensearch`, `oracle`, `postgres`, `redshift`, `s3`, `sqlserver`, `sybase`. Please note that some of engine names are available only for `target` endpoint type (e.g. `redshift`).
* `engine_name` - (Required) Type of engine for the endpoint. Valid values are `aurora`, `aurora-postgresql`, `azuredb`, `azure-sql-managed-instance`, `db2`, `docdb`, `dynamodb`, `elasticsearch`, `kafka`, `kinesis`, `mariadb`, `mongodb`, `mysql`, `opensearch`, `oracle`, `postgres`, `redshift`, `s3`, `sqlserver`, `sybase`. Please note that some of engine names are available only for `target` endpoint type (e.g. `redshift`).
* `kms_key_arn` - (Required when `engine_name` is `mongodb`, cannot be set when `engine_name` is `s3`, optional otherwise)
ARN for the KMS key that will be used to encrypt the connection parameters.
If you do not specify a value for `kms_key_arn`, then AWS DMS will use your default encryption key.
Expand Down