- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果一个人有两个 AWS 账户,一个用于开发,一个用于实时(例如)我知道可以使用 terraform 工作区来管理每个环境的状态。
但是,如果我将工作区从“开发”切换到“实时”,有没有办法告诉 terraform 它现在应该将状态应用于实时帐户而不是测试帐户?
我想到的一种容易出错的方法是交换我的 secret.auto.tfvars
每次我切换工作区时文件,因为我假设当使用不同的访问 key (属于“实时”账户的那个)运行时,AWS 提供商将应用到该账户。但是,交换工作区并存在错误的凭据会非常容易,这将针对错误的环境运行更改。
我正在寻找一种几乎将工作区与 AWS 中的帐户 ID 链接的方法。
我确实找到了这个 https://github.com/hashicorp/terraform/issues/13700但它指的是已弃用的 env
命令,this comment看起来特别有希望
更新
我在我离开的 GitHub 上找到了一些信息 this comment作为对先前评论的回复,该评论建议考虑模块而不是工作区,实际上表明工作区不太适合此任务。如果有人可以提供有关如何使用模块来解决同时维护“相同”基础架构的多个版本的问题的信息,我很想看看这如何改进工作空间的概念。
最佳答案
以下是您如何使用 Terraform 模块来构建指向不同 AWS 账户的实时与开发环境,但这些环境都具有/使用相同的 Terraform 代码。
这是您可以构建目录的(许多)方法之一;你甚至可以将这些模块放入他们自己的 Git 存储库中,但我会尽量不要把事情搞得太乱。在此示例中,您有一个简单的应用程序,它有 1 个 EC2 实例和 1 个 RDS 数据库。您可以在 modules/*/
中编写所需的任何 Terraform 代码。子目录,确保参数化跨环境不同的任何属性。
然后在你的dev/
和 live/
目录,main.tf
应该是一样的,而 provider.tf
和 terraform.tfvars
反射(reflect)特定环境的信息。 main.tf
将调用模块并传入特定于环境的参数。
modules/
|-- ec2_instance/
|-- rds_db/
dev/
|-- main.tf # --> uses the 2 modules
|-- provider.tf # --> has info about dev AWS account
|-- terraform.tfvars # --> has dev-specific values
live/
|-- main.tf # --> uses the 2 modules
|-- provider.tf # --> has info about live/prod AWS account
|-- terraform.tfvars # --> has prod-specific values
当您需要计划/应用任一环境时,您可以放入适当的目录并在那里运行您的 TF 命令。
In particular, organizations commonly want to create a strong separation between multiple deployments of the same infrastructure serving different development stages (e.g. staging vs. production) or different internal teams. In this case, the backend used for each deployment often belongs to that deployment, with different credentials and access controls. Named workspaces are not a suitable isolation mechanism for this scenario.
Instead, use one or more re-usable modules to represent the common elements, and then represent each instance as a separate configuration that instantiates those common elements in the context of a different backend. In that case, the root module of each configuration will consist only of a backend configuration and a small number of module blocks whose arguments describe any small differences between the deployments.
env
workspace
的子命令当他们认为“env”有点太困惑时。
关于terraform - 是否可以将 terraform 工作区链接到 AWS 账户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51787160/
我有一个英国 PayPal 企业帐户。我目前正在开发一个网站支付系统,使用 Express Checkout 向这个账户付款。 到目前为止,我的 PHP 代码正在运行,我能够连接到沙箱并设置和快速结帐
如何使用自定义消息和自定义 from 参数而不是默认参数向用户发送电子邮件验证。 Meteor.methods({ sendveryficationmail: function (theuse
考虑一个场景,其中他们是 PartyA,并且 account1 是在 PartyA 中创建的。现在我们要在account1和PartyA之间发起一笔交易。是否可以有一个由账户发起、接收方为主机节点的交
我有多个 AWS 账户,根据我所在的项目目录,我想在 AWS CLI 中键入命令时使用不同的账户。 我知道 AWS 凭据可以通过环境变量传递,所以我认为一种解决方案是根据它所在的目录设置 AWS_CO
我希望能够使用 PayPal Mass Payment 向我网站的用户付款。如果他们有 PayPal 帐户,我认为这非常简单。 但是,如果他们没有 PayPal 帐户,有没有办法让他们通过我的网站注册
是否可以使用 paypal API 向任何 paypal 帐户(不仅仅是 API 凭据所有者)汇款。我知道使用 IPN 可以做到这一点,但我需要使用 SOAP。 最佳答案 您有两个主要选择:使用 Ma
这个问题在这里已经有了答案: Confirm PayPal sandbox account email (3 个答案) 关闭 2 年前。
是否可以使用 paypal API 向任何 paypal 帐户(不仅仅是 API 凭据所有者)汇款。我知道使用 IPN 可以做到这一点,但我需要使用 SOAP。 最佳答案 您有两个主要选择:使用 Ma
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 8 年前关闭。 Improve this
我一直在尝试 Meteor。我想使用 OAuth 对我网站上的用户进行身份验证,因为我不想自己实现登录功能。 目前我的网站非常简单。计数器,单击按钮计数器就会加一。当用户转到另一台机器并登录其计数时,
在我看来,您可以输入任何随机的用户名/密码组合,并且嵌入式 UI 小部件和后端都会接受它作为有效的 PayPal 帐户。付款和一切都会完成。 有没有办法可以将 Braintree 沙箱设置为仅接受真实
我已经设置并一直在使用 PayPal 使用 IPN/Express Checkout 在我的主网站上接受订单。但是我还有另外 4 个完全独立的网站,我也需要在它们上使用 PayPal 处理订单。购买我
我来这里是为了尝试解决 paypal 中没有人可以帮助我们解决的看似黑洞的问题。 我们有一个企业帐户。 Paypal Express(数码商品)。已验证,解除限制等...我们有 paypal expr
我正在编写一个 Web 应用程序,过去他们使用自己的 PayPal 帐户为外部自雇人员开设的类(class)付款。然而,税收制度已经改变,慈善机构希望他们的客户通过他们的网站预订(就像以前一样),但直
让我解释一下我的网站(ruby on Rails)的当前场景: 1) 我们可以从我的网站创建多个管理员帐户。 2) 每个管理员都有自己的客户,这些客户也有他们的网站访问部分。 3) 每个客户都可以向他
我正在两个 AWS 账户之间迁移。我想从我的 Mac 临时访问两个帐户上的代码提交存储库。 我已经为两个帐户的用户生成了 HTTPS Git 凭据。当我最初访问旧帐户时,它要求我提供存储在 OSX 钥
是否可以将一笔金额从一个关联账户转移到另一个关联账户?两者都在一个 Stripe 帐户下连接。 我知道我可以在两个帐户之间拆分转账,例如 $transfer = \Stripe\Transfer::c
如果一个人有两个 AWS 账户,一个用于开发,一个用于实时(例如)我知道可以使用 terraform 工作区来管理每个环境的状态。 但是,如果我将工作区从“开发”切换到“实时”,有没有办法告诉 ter
在 Meteor 中,我想将数据(和其他 CRUD 函数)插入到 users 表中,该表是在 Meteor 中下载 account-ui 和 account-password 包时生成的。我尝试在 c
有没有办法将 ETH 添加到 Ganache 账户?我知道我通常可以通过重新启动 ganache cli 来刷新帐户,但我使用的是 --db 选项,这意味着帐户是持久的。因此,它们很快就会枯竭。 最佳
我是一名优秀的程序员,十分优秀!