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

main.go is making incorrect assumptions #4

Open
franck-boullier opened this issue Jan 30, 2020 · 10 comments
Open

main.go is making incorrect assumptions #4

franck-boullier opened this issue Jan 30, 2020 · 10 comments

Comments

@franck-boullier
Copy link
Member

Incorrect AWS profile:

In the file main.go
The code reads:

cfg, err := external.LoadDefaultAWSConfig(external.WithSharedConfigProfile("uneet-dev"))

This IS WRONG: we should NOT use uneet-dev here but the correct value based on

  • Installation ID (AWS parameter INSTALLATION_ID)
  • Stage (AWS parameter STAGE)

The correct value for uneet-dev for a given environment is also declared in Travis Setting.
It is then passed on as the variable TRAVIS_PROFILE.

@kaihendry
Copy link
Contributor

"uneet-dev" is just a local default. AWS config has numerous fallbacks and once deployed in the account it will just use what AWS credentials it finds under the role.

We can't make it query the parameter store since it doesn't know which Parameter store to query.

We can assume ${INSTALLATION_ID}-${STAGE} is setup in the local environment, but that's a big ask too, I prefer to keep it simple and hard code a sensible default.

@franck-boullier
Copy link
Member Author

franck-boullier commented Jan 31, 2020

I prefer to keep it simple and hard code a sensible default.

I agree with that statement

What I disagree with is the assumption that uneet-dev is "a sensible default" <-- it is not as the user can be working on

  • a different installation (Unee-T INS instead of Unee-T)
  • a different environment (DEMO or PROD instead of DEV)

uneet-dev is NOT a sensible default.
Maybe we can use your-aws-profile-for-this-envronment-of-this-unee-t-installation instead of uneet-dev?

@kaihendry
Copy link
Contributor

A different installation? Why did you fork everything then? https://github.com/Unee-T-INS/apienroll/blob/master/main.go#L48

When you want another environment like uneet-demo or uneet-prod, the idea is you deploy into the cloud with that AWS_PROFILE set and you run the code in that environment. But when you work locally, you work from the dev.

your-aws-profile-for-this-envronment-of-this-unee-t-installation is not going to be in your ~/.aws/config. The idea is a sensible development default would.

@franck-boullier
Copy link
Member Author

Why did you fork everything then?

Because there was a shit ton of hardcoded values that made it impossible to deploy the Unee-T INS codebase <--- we had edit each of these hardcoded values and I'm now trying to replace all these with variables so we can use the same repo for any Unee-T installation.

@franck-boullier
Copy link
Member Author

When you want another environment like uneet-demo or uneet-prod,

Environment (DEV, DEMO, PROD) is NOT the same as Installation (Unee-T, Unee-T INS, etc...).
Each installation ( Unee-T, Unee-T INS, Unee-T XYZ, etc...) will eventually have 3 different environments (DEV, PROD, DEMO).

@franck-boullier
Copy link
Member Author

your-aws-profile-for-this-envronment-of-this-unee-t-installation is not going to be in your ~/.aws/config. The idea is a sensible development default would.

what about uneet-local-dev <--- adding "local" makes it obvious that this is NOT the same as uneet-dev (which is what we use when we deploy in AWS with Travis).

@kaihendry
Copy link
Contributor

kaihendry commented Jan 31, 2020

Because there is no such AWS_PROFILE (and corresponding account) as uneet-local-dev ?

@franck-boullier
Copy link
Member Author

franck-boullier commented Jan 31, 2020

Because there is no such AWS_PROFILE as uneet-local-dev ?

I'm confused... This is the user's prerogative to setup his/her AWS profile on his local machine as he/she sees fit so why will this be an issue???

@kaihendry
Copy link
Contributor

There is ${INSTALLATION_ID}-dev that should be in place already. Why can't that be used for local development? I am not sure what you are expecting a developer to do. Create another account just for local development?

When I say local development, you generally (since these things are lambdas) are interfacing with AWS API endpoints.

@franck-boullier
Copy link
Member Author

There is ${INSTALLATION_ID}-dev that should be in place already. Why can't that be used for local development?

I see no issue with using ${INSTALLATION_ID}-dev for local development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants