org-formation / org-formation-cli

Better than landingzones!
MIT License
1.41k stars 131 forks source link

Add custom files to initial-commit #314

Open yannickvr opened 2 years ago

yannickvr commented 2 years ago

Subject of the issue

I'm looking to add some custom files when running org-formation init pipeline. I do see that there's code to handle this in init-organization-pipeline.ts, but it doesn't seem that there's a way currently to set the value:

136 public uploadInitialCommit(stateBucketName: string, initialCommitPath: string, templateContents: string, buildSpecContents: string, organizationTasksContents: string, cloudformationTemplateContents: string, orgParametersInclude: string, buildAccessRoleTemplateContents: string): Promise<void> { 159 archive.directory(initialCommitPath, false);

I'm aware of the instructions in the org-formation-reference repository, but those seems cumbersome compared to org-formation init-pipeline

Expected behaviour

org-formation init-pipeline --initial-commit-key myfolderwithmyawesometasks INFO: adding contents of myfolderwithmyawesometasks to initial-commit.zip... INFO: uploading initial commit to S3 organization-formation-12345678901/initial-commit.zip... INFO: creating codecommit / codebuild and codepipeline resources using CloudFormation... INFO: INFO: Your pipeline and initial commit have been created in AWS. INFO: Hope this will get you started! INFO: INFO: Take your time and browse through the source, there is some additional guidance as comments. INFO: INFO: Have fun! INFO: INFO: --OC

yannickvr commented 2 years ago

So, I re-read the code at lines 136+159 again, and found I was reading it wrong. It's using the path var, which boils down to the directory that stores the org-formation CLI. Actually adding files/folders to the initial-commit folder there will upload these files to my initial commit, awesome. Would be more awesome if the CLI let's you do this in a non-hacky way :)

OlafConijn commented 2 years ago

yes, that is indeed a feature we are planning :)

it would work as follows, you run init-pipeline with an argument --template-package-url that points at whatever your initial commit will be. An example of such package you can find here.

A number of arguments will be supported out of the box (inferred from current account, region and other options). another number of arguments can be added when integrating with SAR. The idea being that you can bootstrap an entire organization (including the account) from within SAR by filling in the SAR template and clicking deploy.

if you have a specific use case for this, please hit me up on slack as that might make for an interesting test. thanks!