Small tool to convert an IAM Policy in JSON format into a Terraform aws_iam_policy_document
Check out a web version of the tool here.
For command line usage and automation, check out the instructions below.
$ brew install iam-policy-json-to-terraform
Download the latest binary from the releases page and put it into your PATH
under the name iam-policy-json-to-terraform
If you're a go developer and have your GOPATH
defined and have added your $GOPATH/bin
directory to your path, you can simply run this command.
$ go get github.com/flosell/iam-policy-json-to-terraform
From raw JSON
$ echo '{"Statement":[{"Effect":"Allow","Action":["ec2:Describe*"],"Resource":"*"}]}' | iam-policy-json-to-terraform
data "aws_iam_policy_document" "policy" {
statement {
sid = ""
effect = "Allow"
resources = ["*"]
actions = ["ec2:Describe*"]
}
}
From a JSON policy file
$ iam-policy-json-to-terraform < some-policy.json
If a video demo is more your thing, checkout this nice 2min introduction by the folks at env0.
Clone the repository to a location of your choosing:
$ git clone git@github.com:flosell/iam-policy-json-to-terraform.git
Install dependencies and tools:
$ cd iam-policy-json-to-terraform
$ make tools
make
is your primary point of entry for any development activity. Call it without arguments to learn more:
$ make
build Test and build the whole application
clean Remove build artifacts
fmt Format code
fmtcheck Run linter
seccheck Run security checks
test Run all tests
test-readme Run the commands mentioned in the README for sanity-checking
tools Install additional required tooling
tools-main Install additional required tooling for the main version
tools-web Install additional required tooling for the web version
web-build Build the web version
web-deploy Deploy the web version to GitHub pages
web-e2e Run end to end tests for web version (requires web-build)
web-e2e-live Run end to end tests for web version in live mode for development (requires web-build)
web-serve Serve the web version on a local development server
To develop the web-frontend, you'll need to first compile the JavaScript version of iam-policy-json-to-terraform
.make web-build
will do that, generating a web.js
file.Include it and it'll expose a convert(policyName,jsonString)
function in the global namespace.
Currently, the complete web-frontend is plain HTML, JS and CSS, all within web/index.html
.Edit or refine as needed.
End-To-End Tests for the web frontend exist as TestCafe tests in web_test.js
and can be run using make web-e2e
.
Data Sources data source 主要有以下功能 缓存一些资源信息,如json被其他resource引用。 从aws 加载一些已经存在资源,在plan, apply中被引用。 data "aws_iam_policy_document" "test_resource_role_doc" { statement { actions = [ "ssm:Desc
aws provider access_key-(可选)这是AWS访问密钥。必须提供它,但也可以从AWS_ACCESS_KEY_ID环境变量或共享的凭据文件(如果profile已指定)中获取它。 secret_key-(可选)这是AWS密钥。必须提供它,但也可以从AWS_SECRET_ACCESS_KEY环境变量或共享的凭据文件(如果profile已指定)中获取它。 region-(可选)这是AW
terraform自动化 GCP中的Elasticsearch (Elasticsearch in GCP) We all want to utilize the awesome powers of Elasticsearch, but the number of plugins, configurations, and labyrinthine documentation creates a g
基础 - API 网关 Rest API Terraform 文档 凭借其最小的形式,网关非常简单。 resource "aws_api_gateway_rest_api" "example" { name = "example" } 但是您有很多可选元素,例如: description:API 的快速描述 正文:公开使用OpenAPI 规范公开的 API 服务。 endpoint_
问题内容: The same origin policy 我想制作一个有关HTML / JS 同源策略 的社区Wiki,以希望能帮助搜索此主题的任何人。这是关于SO的最热门搜索主题之一,并且没有统一的Wiki,所以我在这里:) 相同的来源策略可防止从一个来源加载的文档或脚本从另一个来源获取或设置文档的属性。该策略可追溯到Netscape Navigator 2.0。 您采用哪些最喜欢的方式处理sa
问题内容: 我正在尝试使用AWS最近宣布的“ EC2的IAM角色”功能,该功能可让安全凭证自动传递到EC2实例。(请参阅http://aws.amazon.com/about-aws/whats- new/2012/06/11/Announcing-IAM-Roles-for- EC2-instances/ )。 如上所述,我已经设置了一个具有IAM角色的实例。我还可以通过curl获得(貌似)正确
在这个例子中,我们使用JsonNode创建了一个Tree,并将其写入json文件并回读。 在C:\》Jackson_WORKSPACE创建名为C:\》Jackson_WORKSPACE的java类文件。 File: JacksonTester.java import java.io.File; import java.io.IOException; import java.util.Iterato
描述 (Description) Framework7允许您使用以下方法将所有表单字段值转换为JSON - myApp.formToJSON(form) - 此方法接受form作为参数,该参数是HTMLElement或必须转换为JSON的表单string 。 此参数是必需的,此方法返回JSON数据。 每个输入必须具有name属性,否则其值不会出现在JSON中。 多个选择和复选框将在JSON中显示为
JSON to Foundation 是把一个 JSON 对象转换成 Foundation 对象并且导出成类文件。
The XML to JSON Plugin (jQuery.xml2json) is a script you can use to convert simple XML into a JSON object.