scalecube / spinless

0 stars 1 forks source link

Create API to create/update/modify resource #61

Closed snripa closed 4 years ago

snripa commented 4 years ago

Spinless will be in charge of managing infrastructure resources.

Any infrastructure should be created by spinless using terraform

Resource would be represented by :

Any resource type would be mapped to terraform infrastructure (kept in github - link to github _ version)

Resource's state would be kept in S3 bucket. terraform state in S3 will have the following naming:

$bucket/$resource_type/$resource_name/

where:

bucket = exberry-terraform-states-$account ( for example exberry-terraform-states-staging)
resource_type - type of resource (for example 'cloud'/'kafka'/postgress'/...)
resource_name - name (identifier)of resource - for example, 'kafka-ldx-stg', 'shared-kafka-testing', 'kafka-ldx-prod45'

Spinless should manage mapping between resource type and terraform sources:

'kafka" : {"ref" : "git@github.com:scalecube/terraform-kafka.git" , "version" : "0.13"}

Requests to create resources with the same type and name should be idempotent

Sample request (create resource): POST https://spinless.stg.com/resources

{
    "type": "cluster",
    "name": "exberry-tenant-1",
    "version": "0.13", //optional
    "account": "staging",
    "properties": {
        "cluster_name": "real-55",
        "cluster_type": "exchange",
        "region": "eu-west-2",
        "secret_name": "hardcore",
        "cloud": "aws",
        "dns_suffix": "test1.io"
    }
}

Sample request (delete resources) DELETE https://spinless.stg.com/resources/${resource_type}/${resource_name}

{
    "account": "staging"    
}