The Google Analyze Code Security plugin for Jenkins identifies insecure configurations in Infrastructure as Code (IaC) files for Google Cloud resources. This plugin requires Terraform plan files in JSON format for scanning.
Note: Don’t enter any sensitive information such as passwords and other personal identifiable information in the Terraform plan files.
- In the Google Cloud organization which includes the resources that you want to change, create a service account.
- Add the
Security Posture Admin
role or theSecurity Posture Shift-Left Validator
role to the service account. - Create the service account key in JSON format and download the JSON file.
- In the Jenkins console, click
Manage Jenkins
>Configure System
. - In the Google Analyze Code Security section, click Add to add the service account key.
- Add the service account key.
OrganizationId
: Enter the organization ID for the Google Cloud organization that includes the resources.SCC Credentials
: Add the service account key.
- [Optional] To validate the credentials, click Test Connection.
- To add additional service account keys, click Add.
- Click Save.
- In the Jenkins console, click Corresponding Project > Configuration.
- Click Add build step > Perform Code Scan during Build.
- Complete the following fields:
- OrganizationID: The Google Cloud organization ID.
- Scan File Name: The name of the Terraform plan file (in JSON format) that you want to scan. The plugin scans the workspace directory and its subdirectories for the file, if you don’t enter a {Scan File Path}.
- Scan File Path [Optional]: The path to the JSON plan file, relative to the project workspace directory. For example, if the file is located in
/xyz/abc/myplanfile.json
, the file path is/xyz/abc
. - Scan Time Out[Millisecond]: The time after which the plugin stops and changes the build status to failure.
- Plugin Failure Configuration: Determines build status when the plugin runs into an error. If you set this field to
true
, the build status is marked asSUCCESS
. Otherwise, if you set this field tofalse
, the build status is marked asFAILED
.
- Complete one of the following actions to determine how a build proceeds:
- Click Save.
- To run the project, click Build Now.
- To view the plugin report, click the most recent workflow.
For information about supported asset types and policies, see IaC Validation - Supported assets and policies.