These early examples show how to use terraform to extract data from the bridgecrew platform, and how to create policies in code.
How to set-up the provider and authentication.
Add your bridgecrew API key as an Environmental variable:
export BRIDGECREW_API="xxxx"
Demonstrates the 6 of the current data sources for repositories, policies, suppressions and the newer authors,incidents and justifications.
Demonstrates how to create a basic policy in Terraform.
Demonstrates how to create a yaml policy in Terraform.
Each Folder has a video walk-through.
This examples shows you how to create a policy and then using it against some IaC. Check a Terraform template against your current policy set, buy running the Make target fail:
make fail
This template would provision an aws_instance of the instance_type t3.medium.
Then we add a new policy that checks that the instance size of the aws_instance resource is "t3.micro", run the Make Target policy:
make policy
Once the policy is deployed you can test it again with previous Make fail target:
make fail
And you should see (In your Checkov output):
Check: james_aws_1636551748078: "Ensure Developers use the AWS free tier"
FAILED for resource: aws_instance.non_compliant
File: /aws_instance.non_compliant.tf:18-27
18 | resource "aws_instance" "non_compliant" {
19 | # checkov:skip=CKV_AWS_79: ADD REASON
20 | ami = data.aws_ami.ubuntu.id
21 | instance_type = "t3.medium"
22 | root_block_device {
23 | encrypted = true
24 | }
25 | monitoring = true
26 | ebs_optimized = true
27 | }
Finally remove the added check with target destroy:
make destroy
This example shows how to define a tag rule for the platform.
No requirements.
No providers.
No modules.
No resources.
No inputs.
No outputs.
Got a question?
File a GitHub issue.
Please use the issue tracker to report any bugs or file feature requests.
Copyright © 2021-2022 James Woolfenden
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.