serverless-meta-sync icon indicating copy to clipboard operation
serverless-meta-sync copied to clipboard

not all variables being synced

Open edclement opened this issue 8 years ago • 5 comments

currently using commit f2134b114bcf2a90999221071e38098a529376a3 so I can make use of the s3 prefix. When I call sls meta sync without args, it will sync only s-variables-stage but not s-variables-stage-region. I just started a new project so I only have one stage. Also, how do you sync the common variables?

edclement avatar Mar 29 '16 18:03 edclement

@edclement Not syncing of the region variables is a big problem and we will look into this right away.

However, Project Variables (s-variables-common) currently aren't synced. We're not sure yet if we should support syncing project-wide variables, since it might get messy. For example, if a team has separate AWS accounts per stage, and each account has a Meta bucket holding onto a copy of s-variables-common they will essentially just be staging out their common variables, which seems redundant. Instead, we're thinking about recommending people put most things in stage/region variable files and only allowing those to be synced. It's clear isolation.

What do you think about this @edclement? Thanks for your input so far btw :)

austencollins avatar Mar 29 '16 19:03 austencollins

@edclement If I remember correctly @minibikini and I decided also to only allow for one file to be synced per command. So to sync the region file, you will have to provide an -r <region>. This isn't a bug. It's the current design. Please suggest improvements. We're listening.

austencollins avatar Mar 29 '16 19:03 austencollins

it would be great if we could customize the functionality of the plugin in s-project.json. Maybe something like this:

{
  custom: {
    "meta": {
      "name": "serverless.us-east-1.project.com",
      "region": "us-east-1",
      "keyPrefix": "appApi/variables",
      "sync": {
        "variables: {
           "common": true,
           "regions": ["us-east-1", "us-west-1"],
           "stages": ["dev1", "demo"]
        },
        "resources": {
           "regions": ["us-east-1", "us-west-1"],
           "stages": ["dev1", "demo"]
        }
      }
    }
  }
}

I wish I had some spare time so I could implement this and open a PR. Keep up the great work.

edclement avatar Mar 29 '16 20:03 edclement

I had similar reaction as @edclement. I had only one region and stage in my project, and ran meta sync, I expected the proj common, stage common (s-variables-dev.json) and region (s-variables-dev-useast1.json) to all be synced.

I think if this project is renamed per https://github.com/serverless/serverless-meta-sync/issues/12 things become much more clear. You can then solve the problems brought up in this issue (as well as issues in https://github.com/serverless/serverless-meta-sync/issues/11) as follows:

Use cases (using stage dev as example):

I want to sync vars for my dev stage in us-east-1

serverless meta sync-vars -r us-east-1 -s dev

I want to sync vars for my dev stage in ALL regions

serverless meta sync-vars -r ALL -s dev

I want to sync common vars

serverless meta sync-vars --common

I think the current functionality of -r and -s only being optional if there is one stage and region defined is good.

I also think a -s ALL is not needed because I don't envision a scenario where someone would be working on multiple stages at once that often. In fact -s ALL would lead to potential mistakes where someone would be "pushing" vars unintentionally to stages they are not actively working on

doapp-ryanp avatar Mar 31 '16 20:03 doapp-ryanp

it seems to me like the common variables would be the thing you most want to sync... we have multple developers working on the same serverless api project and there doesnt' seem to be a good way to move this configuration around.

jjmartin avatar Apr 28 '16 20:04 jjmartin