Skip to content

Commit

Permalink
added sample of plan to kics query
Browse files Browse the repository at this point in the history
  • Loading branch information
cx-joao-reigota committed Oct 12, 2021
1 parent 8c4cb08 commit 1e14172
Show file tree
Hide file tree
Showing 7 changed files with 466 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ settings_are_equal(resource, rest_api_id, stage_name) {
usage_plan.api_stages.api_id == rest_api_id
usage_plan.api_stages.stage == stage_name
}

# api_stages can also be an array
settings_are_equal(resource, rest_api_id, stage_name) {
usage_plan := resource.aws_api_gateway_usage_plan[_]
usage_plan.api_stages[_].api_id == rest_api_id
usage_plan.api_stages[_].stage == stage_name
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ resource "aws_api_gateway_usage_plan" "negative2" {
api_id = "rest_api_1"
stage = "development"
}

api_stages {
api_id = "rest_api_2"
stage = "development_2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"format_version": "0.2",
"terraform_version": "1.0.5",
"planned_values": {
"root_module": {
"resources": [
{
"address": "aws_api_gateway_deployment.negative1",
"mode": "managed",
"type": "aws_api_gateway_deployment",
"name": "negative1",
"provider_name": "registry.terraform.io/hashicorp/aws",
"schema_version": 0,
"values": {
"description": null,
"rest_api_id": "rest_api_1",
"stage_description": null,
"stage_name": "development",
"triggers": null,
"variables": null
},
"sensitive_values": {}
},
{
"address": "aws_api_gateway_usage_plan.negative2",
"mode": "managed",
"type": "aws_api_gateway_usage_plan",
"name": "negative2",
"provider_name": "registry.terraform.io/hashicorp/aws",
"schema_version": 0,
"values": {
"api_stages": [
{
"api_id": "rest_api_1",
"stage": "development"
}
],
"description": "my description",
"name": "my-usage-plan",
"product_code": "MYCODE",
"quota_settings": [],
"tags": null,
"throttle_settings": []
},
"sensitive_values": {
"api_stages": [
{}
],
"quota_settings": [],
"tags_all": {},
"throttle_settings": []
}
}
]
}
},
"resource_changes": [
{
"address": "aws_api_gateway_deployment.negative1",
"mode": "managed",
"type": "aws_api_gateway_deployment",
"name": "negative1",
"provider_name": "registry.terraform.io/hashicorp/aws",
"change": {
"actions": [
"create"
],
"before": null,
"after": {
"description": null,
"rest_api_id": "rest_api_1",
"stage_description": null,
"stage_name": "development",
"triggers": null,
"variables": null
},
"after_unknown": {
"created_date": true,
"execution_arn": true,
"id": true,
"invoke_url": true
},
"before_sensitive": false,
"after_sensitive": {}
}
},
{
"address": "aws_api_gateway_usage_plan.negative2",
"mode": "managed",
"type": "aws_api_gateway_usage_plan",
"name": "negative2",
"provider_name": "registry.terraform.io/hashicorp/aws",
"change": {
"actions": [
"create"
],
"before": null,
"after": {
"api_stages": [
{
"api_id": "rest_api_1",
"stage": "development"
}
],
"description": "my description",
"name": "my-usage-plan",
"product_code": "MYCODE",
"quota_settings": [],
"tags": null,
"throttle_settings": []
},
"after_unknown": {
"api_stages": [
{}
],
"arn": true,
"id": true,
"quota_settings": [],
"tags_all": true,
"throttle_settings": []
},
"before_sensitive": false,
"after_sensitive": {
"api_stages": [
{}
],
"quota_settings": [],
"tags_all": {},
"throttle_settings": []
}
}
}
],
"configuration": {
"root_module": {
"resources": [
{
"address": "aws_api_gateway_deployment.negative1",
"mode": "managed",
"type": "aws_api_gateway_deployment",
"name": "negative1",
"provider_config_key": "aws",
"expressions": {
"rest_api_id": {
"constant_value": "rest_api_1"
},
"stage_name": {
"constant_value": "development"
}
},
"schema_version": 0
},
{
"address": "aws_api_gateway_usage_plan.negative2",
"mode": "managed",
"type": "aws_api_gateway_usage_plan",
"name": "negative2",
"provider_config_key": "aws",
"expressions": {
"api_stages": [
{
"api_id": {
"constant_value": "rest_api_1"
},
"stage": {
"constant_value": "development"
}
}
],
"description": {
"constant_value": "my description"
},
"name": {
"constant_value": "my-usage-plan"
},
"product_code": {
"constant_value": "MYCODE"
}
},
"schema_version": 0
}
]
}
}
}
Loading

0 comments on commit 1e14172

Please sign in to comment.