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

add resource azurerm_cosmosdb_sql_trigger #11535

Merged

Conversation

ms-henglu
Copy link
Contributor

The added tests are listed as follows.

=== RUN   TestAccCosmosDbSQLTrigger_basic
=== PAUSE TestAccCosmosDbSQLTrigger_basic
=== CONT  TestAccCosmosDbSQLTrigger_basic
--- PASS: TestAccCosmosDbSQLTrigger_basic (1271.04s)
=== RUN   TestAccCosmosDbSQLTrigger_requiresImport
=== PAUSE TestAccCosmosDbSQLTrigger_requiresImport
=== CONT  TestAccCosmosDbSQLTrigger_requiresImport
--- PASS: TestAccCosmosDbSQLTrigger_requiresImport (1224.34s)
=== RUN   TestAccCosmosDbSQLTrigger_update
=== PAUSE TestAccCosmosDbSQLTrigger_update
=== CONT  TestAccCosmosDbSQLTrigger_update
--- PASS: TestAccCosmosDbSQLTrigger_update (1339.53s)

Comment on lines 50 to 68
"account_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.CosmosAccountName,
},

"container_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.CosmosEntityName,
},

"database_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.CosmosEntityName,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can parse this out of a resource id?

ValidateFunc: validation.StringIsNotEmpty,
},

"trigger_operation": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trigger is in the resource name?

Suggested change
"trigger_operation": {
"operation": {

}, false),
},

"trigger_type": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"trigger_type": {
"type": {

@ms-henglu
Copy link
Contributor Author

@katbyte , hi, I updated this PR, could you please take another look? Thanks!

@ghost ghost removed the waiting-response label May 6, 2021
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ms-henglu - one last comment and this should be good to merge

Comment on lines 91 to 99
resourceGroup := containerId.ResourceGroup
accountName := containerId.DatabaseAccountName
containerName := containerId.ContainerName
databaseName := containerId.SqlDatabaseName
body := d.Get("body").(string)
triggerOperation := d.Get("operation").(string)
triggerType := d.Get("type").(string)

id := parse.NewSqlTriggerID(subscriptionId, resourceGroup, accountName, databaseName, containerName, name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to assign these to an intermediate?

Suggested change
resourceGroup := containerId.ResourceGroup
accountName := containerId.DatabaseAccountName
containerName := containerId.ContainerName
databaseName := containerId.SqlDatabaseName
body := d.Get("body").(string)
triggerOperation := d.Get("operation").(string)
triggerType := d.Get("type").(string)
id := parse.NewSqlTriggerID(subscriptionId, resourceGroup, accountName, databaseName, containerName, name)
body := d.Get("body").(string)
triggerOperation := d.Get("operation").(string)
triggerType := d.Get("type").(string)
id := parse.NewSqlTriggerID(subscriptionId, containerId.ResourceGroup, containerId.AccountName, containerId.DatabaseName, containerId.Name, name)

Options: &documentdb.CreateUpdateOptions{},
},
}
future, err := client.CreateUpdateSQLTrigger(ctx, resourceGroup, accountName, databaseName, containerName, name, createUpdateSqlTriggerParameters)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@ms-henglu ms-henglu force-pushed the branch-210430-implement-sql-trigger branch from 58a5a93 to e7f7d45 Compare May 7, 2021 01:44
@ms-henglu
Copy link
Contributor Author

@katbyte , thanks for code review, I updated pr according to your suggestion.

@ghost ghost removed the waiting-response label May 7, 2021
@katbyte katbyte added this to the v2.58.0 milestone May 7, 2021
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ms-henglu - LGTM 👍

@katbyte katbyte merged commit 3277582 into hashicorp:master May 7, 2021
katbyte added a commit that referenced this pull request May 7, 2021
@ghost
Copy link

ghost commented May 7, 2021

This has been released in version 2.58.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.58.0"
}
# ... other configuration ...

favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
@github-actions
Copy link

github-actions bot commented Jun 7, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants