在使用GitHub Actions时,我如何在我的AWS环境中运行Terraform?

huangapple go评论57阅读模式
英文:

When using GitHub Actions, how can I run my Terraform on my AWS environment?

问题

我正在将我的部署从Jenkins迁移到GitHub Actions。

我了解如何从我的存储库拉取、构建并测试我的应用程序。
但我目前在Jenkins中执行的步骤之一是使用Terraform更新我的基础设施。这意味着代码必须在我的AWS环境中运行的实例上运行。

在使用GitHub Actions时,如何实现这一点呢?

英文:

I am migrating my deployment from Jenkins to GitHub Actions.

I understand how to pull from my repository, build, test my application.
But one of the steps I currently perform inside of Jenkins is to update my infrastructure using Terraform. This means the code has to run on an instance running in my AWS environment.

How is this possible when using GitHub Actions?

答案1

得分: 1

我更喜欢使用自托管的运行环境,而不是GitHub Actions的默认运行环境。简单的原因是默认运行环境存在安全问题,需要提供AWS Secret Access Keys和IDs。这是我在项目中使用的优秀模块terraform-aws-github-runner

英文:

I prefer Self-host runner environment to default runners of GitHub Actions.The simple reason is security issues that arise with default runners,you must provide them AWS Secret Access Keys and IDs.This is the excellent module terraform-aws-github-runner that I used for my project.

答案2

得分: 0

你可以使用AWS凭证配置操作来设置AWS访问。您可以使用这些凭证通过GitHub Actions工作流在您的实例上运行SSM文档,可以通过AWS CLI或存储库中的脚本来实现。SSM文档直接在实例上运行。

英文:

You can setup AWS Access using AWS Credentials Configure action. You can use these credentials to run a SSM document for your instances through the GitHub Actions workflow either via the AWS CLI or a script in your repository. SSM documents run directly on the instances.

huangapple
  • 本文由 发表于 2023年2月10日 06:48:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75405247.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定