infra-cli
npm install -g @ef-class/infra-cli
infrastructure teardown
-
infra-cli teardown --app {{app}} --branch {{branch}}
- delete the CloudFront CDNs for the apps
- delete the domains for the apps
infrastructure create
-
infra-cli create --acc {{account}} --app {{app}} --branch {{branch}}
- create the CloudFront CDNs for the apps
- create the domains for the apps
infrasturcture check
-
infra-cli check --acc {{account}} --app {{app}} --branch {{branch}}
- checks the Terrafrom script is correct
--app
Can be have a vlaue of '*' which equates to all the apps in the config or it can be a listy 'a,b,c' or it can be a single app 'a'
Config file
You will need to create this config file and add it to the root of the project.
infra.config.json
{
"devel": {
"account": "devel",
"apps": ["accounts", "student", "teacher", "static", "lesson-item-renderer", "design-system"],
"state": {
"bucket": "ctx-terraform-state-devel",
"dir": "devel/fe_features",
"region": "eu-west-1"
},
"aws": {
"secret": "{{aws secrect}}",
"key": "{{aws key}}",
"region": "eu-west-1"
},
"terraform": {
"delimiter": "o",
"domain": "ctx.ef.com",
"s3": {
"bucket": "ef-class-web-devel",
"loggingPrefix": "logs/cloudfront/",
"originAccessIdentity": "origin-access-identity/cloudfront/E3N3GP1T23HRMI"
},
"r53": {
"zoneId": "ZVRF914X2I9LY"
},
"cf": {
"amcCert": "arn:aws:acm:us-east-1:817216657652:certificate/c6c4616d-0f8d-492e-bf1e-9d66c17e3730"
}
}
}
}
Usage
cd ef-class/ef-class-web
infra-cli --help
infra-cli teardown --help
infra-cli create --help
infra-cli check --help
Development
npm run test
to run the tests. This command first builds then runs the tests.
npm run refresh
to install the cli locally for manual testing. You can run this command after a code update and it'll build and reinstall the npm package for the cli locally.
npm run build
transpiles the ts to js.