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

azurerm_cosmosdb_cassandra_cluster - support for the HoursBetweenBackups property #18154

Merged
merged 5 commits into from
Aug 31, 2022
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
5 changes: 3 additions & 2 deletions internal/services/cosmos/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package client

import (
"github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb"
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras"
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
CassandraClient *documentdb.CassandraResourcesClient
CassandraClustersClient *documentdb.CassandraClustersClient
CassandraClustersClient *managedcassandras.ManagedCassandrasClient
CassandraDatacentersClient *documentdb.CassandraDataCentersClient
DatabaseClient *documentdb.DatabaseAccountsClient
GremlinClient *documentdb.GremlinResourcesClient
Expand All @@ -25,7 +26,7 @@ func NewClient(o *common.ClientOptions) *Client {
cassandraClient := documentdb.NewCassandraResourcesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&cassandraClient.Client, o.ResourceManagerAuthorizer)

cassandraClustersClient := documentdb.NewCassandraClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
cassandraClustersClient := managedcassandras.NewManagedCassandrasClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&cassandraClustersClient.Client, o.ResourceManagerAuthorizer)

cassandraDatacentersClient := documentdb.NewCassandraDataCentersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
Expand Down
174 changes: 94 additions & 80 deletions internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
)
Expand Down Expand Up @@ -87,17 +87,17 @@ func testAccCassandraCluster_update(t *testing.T) {
}

func (t CassandraClusterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.CassandraClusterID(state.ID)
id, err := managedcassandras.ParseCassandraClusterID(state.ID)
if err != nil {
return nil, err
}

resp, err := clients.Cosmos.CassandraClustersClient.Get(ctx, id.ResourceGroup, id.Name)
resp, err := clients.Cosmos.CassandraClustersClient.CassandraClustersGet(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading %q: %+v", id, err)
}

return utils.Bool(resp.ID != nil), nil
return utils.Bool(resp.Model != nil), nil
}

func (r CassandraClusterResource) basic(data acceptance.TestData) string {
Expand Down Expand Up @@ -133,6 +133,7 @@ resource "azurerm_cosmosdb_cassandra_cluster" "test" {
client_certificate_pems = [file("testdata/cert.pem")]
external_gossip_certificate_pems = [file("testdata/cert.pem")]
external_seed_node_ip_addresses = ["10.52.221.2"]
hours_between_backups = 22

identity {
type = "SystemAssigned"
Expand Down Expand Up @@ -164,6 +165,7 @@ resource "azurerm_cosmosdb_cassandra_cluster" "test" {
client_certificate_pems = [file("testdata/cert2.pem")]
external_gossip_certificate_pems = [file("testdata/cert2.pem")]
external_seed_node_ip_addresses = ["10.52.221.5"]
hours_between_backups = 0

tags = {
Env = "Test2"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading