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

Amazon Managed Apache Cassandra Service / Keyspaces #11221

Closed
markvdlaan93 opened this issue Dec 10, 2019 · 17 comments · Fixed by #24351
Closed

Amazon Managed Apache Cassandra Service / Keyspaces #11221

markvdlaan93 opened this issue Dec 10, 2019 · 17 comments · Fixed by #24351
Labels
new-resource Introduces a new resource. service/keyspaces Issues and PRs that pertain to the keyspaces service.

Comments

@markvdlaan93
Copy link

markvdlaan93 commented Dec 10, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Since one week, AWS released Managed Apache Cassandra service in a couple of regions: https://aws.amazon.com/mcs/. Obviously, I can't find anything in the Terraform docs, so I'm assuming that this still needs to be implemented. If this is the case, I would like to contribute. Please have a look at the potential Terraform configuration below.

New or Affected Resource(s)

I'm not sure which existing resources are affected by this but new resources could be named:

  • aws_mcs_keyspace
  • aws_mcs_table

Potential Terraform Configuration

"aws_mcs_keyspace" "example" {
     name = "mcs-keyspace-example"
     exists = "true"
     region = "eu-north-1"
     replication {
         class = "SingleRegionStrategy"
     }
}

"aws_mcs_table" "example" {
   name = "mcs-table-example"
   keyspace_arn = "${aws_mcs_keyspace.example.arn}"
   exists = "true"
   fields {
       columns {
            name = "name",
            type = "text",
       }
       columns {
            name = "email",
            type = "text",
       }
   }
   primary_key = ["email", "name"]
   # clustering key?
}

References

@markvdlaan93 markvdlaan93 added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 10, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 10, 2019
@bflad bflad added new-resource Introduces a new resource. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Dec 10, 2019
@bflad
Copy link
Contributor

bflad commented Dec 10, 2019

Hi @markvdlaan93 👋 Thank you for submitting this.

At this current time, AWS has not released an API or SDK for this new service:

Without these, we cannot implement support for this AWS service in Terraform. Please reach out to AWS Support or your account managers to ask about API support.

@bflad bflad added upstream Addresses functionality related to the cloud provider. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 10, 2019
@ansha1
Copy link

ansha1 commented Jan 2, 2020

Hi Everyone !
I am also looking for terraform documentation for setting up mcs. Please let us know if we have any
Thanks,
Anurag

@ewbankkit
Copy link
Contributor

ewbankkit commented Apr 24, 2020

Amazon Keyspaces (for Apache Cassandra) is now generally available:

No support in the AWS SDK yet though.

@kvaidas
Copy link

kvaidas commented May 16, 2020

It appears some sort of integration with an IAM user might be necessary since that's where one would create a Cassandra credential that's used by clients to connect.

@codingconcepts
Copy link

codingconcepts commented Oct 20, 2020

Hey all,

I was battling with this today and wanted to share my solution in case it's helpful for anyone else. I ended up using CloudFormation via Terraform as follows to create a keyspace and a table:

main.tf

provider "aws" {
  region = "eu-central-1"
  version = "~> 3.0"
}

resource "aws_cloudformation_stack" "keyspaces" {
  name = "my-keyspace"

  template_body = file("./keyspace.yaml")
}

keyspace.yaml

AWSTemplateFormatVersion: 2010-09-09
Resources:
  MyKeyspace:
    Type: AWS::Cassandra::Keyspace
    Properties:
      KeyspaceName: abc
  
  MyTable:
    Type: AWS::Cassandra::Table
    DependsOn: MyKeyspace
    Properties:
      KeyspaceName: abc
      TableName: my_table
      PartitionKeyColumns:
        - ColumnName: id
          ColumnType: TEXT
      BillingMode:
        Mode: ON_DEMAND

NOTE: Column changes aren't currently supported by CloudFormation, so once your table has been created, you can't change it with Terraform/CloudFormation.

@trajano
Copy link

trajano commented Feb 27, 2021

Amazon renamed MCS to Keyspaces. https://ca-central-1.console.aws.amazon.com/keyspaces/home we should use that name instead and change the title of the bug accordingly so people can find it more easily.

@FrailWords
Copy link

Another workaround is to use a JSON template -

{
  "Resources": {
    "Keyspace1": {
      "Type": "AWS::Cassandra::Keyspace",
      "Properties": {
        "KeyspaceName": "${keyspaces_name}"
      }
    },
    %{ for table in tables ~}
    "table${table.index}": {
      "Type": "AWS::Cassandra::Table",
      "Properties": {
        "KeyspaceName": {
          "Ref": "Keyspace1"
        },
        "TableName": "${table.name}",
        "RegularColumns": [
          %{ for regular_column in table.regular_columns ~}
          {
            "ColumnName": "${regular_column.name}",
            "ColumnType": "${regular_column.type}"
          },
          %{ endfor ~}
        ],
        "PartitionKeyColumns": [
          %{ for partition_key_column in table.partition_key_columns ~}
          {
            "ColumnName": "${partition_key_column.name}",
            "ColumnType": "${partition_key_column.type}"
          },
          %{ endfor ~}
        ],
        "ClusteringKeyColumns": [
          %{ for clustering_key_column in table.clustering_key_columns ~}
          {
            "Column": {
              "ColumnName": "${clustering_key_column.name}",
              "ColumnType": "${clustering_key_column.type}"
            },
            "OrderBy":"%{ if clustering_key_column.order_by != "" }${clustering_key_column.order_by}%{ else }"ASC"%{ endif }"
          },
          %{ endfor ~}
        ],
        "BillingMode":{
          "Mode":"%{ if table.billing.mode != "" }${table.billing.mode}%{ else }"ON_DEMAND"%{ endif }"
          %{ if table.billing.mode == "PROVISIONED" }
          , "ProvisionedThroughput":{
            "ReadCapacityUnits":${table.billing.read_capacity_units},
            "WriteCapacityUnits":${table.billing.write_capacity_units}
          }
          %{ endif }
        }, "Tags": [
          %{ for tag in table.tags ~}
          {
            "Key": "${tag.key}",
            "Value": "${tag.value}"
          },
          %{ endfor ~}
        ],
        "PointInTimeRecoveryEnabled": ${table.point_in_time_recovery}
      }
    }
    %{ endfor ~}
  }
}

and use an input to the templatefile function from terraform with an input like -

{
  "keyspaces_name": "k12",
  "tables": [
    {
      "name": "some_table",
      "index": 1,
      "partition_key_columns": [
        {
          "name": "p_test1",
          "type": "ascii"
        },
        {
          "name": "p_test2",
          "type": "int"
        }
      ],
      "clustering_key_columns": [
        {
          "name": "c_test1",
          "type": "text",
          "order_by": "asc"
        },
        {
          "name": "c_test2",
          "type": "text",
          "order_by": "desc"
        }
      ],
      "regular_columns": [
        {
          "name": "r_test1",
          "type": "set<text>"
        },
        {
          "name": "r_test2",
          "type": "list<int>"
        }
      ],
      "billing": {
        "mode": "PROVISIONED",
        "read_capacity_units": 5,
        "write_capacity_units": 5
      },
      "tags": [
        {
          "key": "tag1",
          "value": "value1"
        },
        {
          "key": "tag2",
          "value": "value2"
        }
      ],
      "point_in_time_recovery": true
    }
  ]
}

@markvdlaan93 markvdlaan93 changed the title Amazon Managed Apache Cassandra Service Amazon Managed Apache Cassandra Service / Keyspaces Mar 19, 2021
@AndreyNovik1993
Copy link

AndreyNovik1993 commented Jul 12, 2021

What date will it be released?

@daryl-d
Copy link

daryl-d commented Mar 3, 2022

Looks like this can be managed in sdk

https://aws.amazon.com/about-aws/whats-new/2022/03/amazon-keyspaces-automate-resource-management-sdk/

@ewbankkit
Copy link
Contributor

ewbankkit commented Mar 4, 2022

AWS SDK for Go support released in v1.43.10.
Relates #23494.

@roberth-k
Copy link
Contributor

I'll pick this up over the next few weeks.

@saurabh-program
Copy link

I'll pick this up over the next few weeks.

Hi @roberth-k. Thanks for picking this up. Even I was planning to work on this. Maybe we can coordinate and work together on this.

@roberth-k
Copy link
Contributor

I'll pick this up over the next few weeks.

Hi @roberth-k. Thanks for picking this up. Even I was planning to work on this. Maybe we can coordinate and work together on this.

Hi @saurabh-program.

I don't think it's likely that we could efficiently work on the same resource at the same time. However, I've just published a PR (#23770) for aws_keyspaces_keyspace, and you're welcome to pick up aws_keyspaces_table if you'd like. Please let me know if that is what you prefer.

@saurabh-program
Copy link

Sure. I

I'll pick this up over the next few weeks.

Hi @roberth-k. Thanks for picking this up. Even I was planning to work on this. Maybe we can coordinate and work together on this.

Hi @saurabh-program.

I don't think it's likely that we could efficiently work on the same resource at the same time. However, I've just published a PR (#23770) for aws_keyspaces_keyspace, and you're welcome to pick up aws_keyspaces_table if you'd like. Please let me know if that is what you prefer.

That works. I'll pick up the aws_keyspaces_table resource.

@pranayw333
Copy link

pranayw333 commented Apr 22, 2022

Similar: #24265 Adding support for table resource #24351

@ewbankkit ewbankkit added service/keyspaces Issues and PRs that pertain to the keyspaces service. and removed upstream Addresses functionality related to the cloud provider. labels Apr 28, 2022
@breathingdust
Copy link
Member

Hi all 👋 Just letting you know that support for the aws_keyspaces_table resource is featured on this quarters roadmap. If a PR exists to close the issue a maintainer will review and either make changes directly, or work with the original author to get the contribution merged. If you have written a PR to resolve the issue please ensure the "Allow edits from maintainers" box is checked. Thanks for your patience and we are looking forward to getting this merged soon!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/keyspaces Issues and PRs that pertain to the keyspaces service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.