awslabs / landing-zone-accelerator-on-aws

Deploy a multi-account cloud foundation to support highly-regulated workloads and complex compliance requirements.
https://aws.amazon.com/solutions/implementations/landing-zone-accelerator-on-aws/
Apache License 2.0
532 stars 421 forks source link

Support of Github/Github enterprise for ConfigRepository #200

Closed snemir2 closed 11 months ago

snemir2 commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Currently, config repository is expected to be in CodeCommit. Our (and many others, I speculate) rely on github for GitOPS and switching LZA config repository to github would really improve (and comply with existing) change processes.

Describe the feature you'd like I am looking for a supported way to point pipeline to github for configuration repository.

Additional context Add any other context or screenshots about the feature request here.

Concerned that if i modify the pipeline updating the lza/pipeline itself will become too problematic.

stuartgraham commented 1 year ago

As a work around, take a look attsgit18/sync-up-to-codecommit-action and zulhfreelancer/aws-codepipeline-action actions. You can use these in a GitHub Actions workflow drive GitOps from your GHE repo.

+1 for the feature request though.

snemir2 commented 1 year ago

Just an fyi.. basically ended up doing the following via github actions

      - name: Push github repo  to codecommit 
        run: |       
          RepositoryName="${{ env.CODECOMMIT_REPO }}"
          AwsRegion="${{ env.AWS_REGION }}"
          CodeCommitUrl="https://git-codecommit.${AwsRegion}.amazonaws.com/v1/repos/${RepositoryName}"

          git config --global --add safe.directory /github/workspace
          git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@'
          git config --global credential.UseHttpPath true
          git remote add sync ${CodeCommitUrl}
          git push sync --mirror --verbose

      - name: Release updates in codepipeline.  
        run: |  
          aws codepipeline start-pipeline-execution --name "${{ env.CODEPIPELINE }}"
stuartgraham commented 1 year ago

Interesting, seems like this would achieve the same thing as the two actions we are using as a shortcut. Will take a look at this, thanks.

snemir2 commented 1 year ago

yeah, literally same thing, just more implicit (in my opinion)

I would say that native github support would have been cleaner/better though.:-)

awsclemj commented 11 months ago

Hello, and thank you for the feedback!

We understand that users may want more flexibility for upstream repositories. However, at this time the LZA team is not evaluating additional sources for the configuration or source code repositories, as these connections to CodePipeline require the CodeStar service which is not currently available in all regions and partitions. Including these options would limit the number of regions our solution is supported in.

As discussed in this thread, a workaround is to automate the mirroring of your configuration changes between your repository of choice and the solution-provided CodeCommit repository.

Thank you for your support of the LZA solution! I will mark this issue as resolved, but please don’t hesitate to reach out with additional feedback.