This resource allows you to manage code security and analysis settings for a GitHub Enterprise account. This controls Advanced Security, Secret Scanning, and related security features that are automatically enabled for new repositories in the enterprise.
You must have enterprise admin access to use this resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Basic security settings - enable secret scanning only
const basic = new github.EnterpriseSecurityAnalysisSettings("basic", {
enterpriseSlug: "my-enterprise",
secretScanningEnabledForNewRepositories: true,
});
// Full security configuration with all features enabled
const comprehensive = new github.EnterpriseSecurityAnalysisSettings("comprehensive", {
enterpriseSlug: "my-enterprise",
advancedSecurityEnabledForNewRepositories: true,
secretScanningEnabledForNewRepositories: true,
secretScanningPushProtectionEnabledForNewRepositories: true,
secretScanningValidityChecksEnabled: true,
secretScanningPushProtectionCustomLink: "https://octokit.com/security-guidelines",
});
import pulumi
import pulumi_github as github
# Basic security settings - enable secret scanning only
basic = github.EnterpriseSecurityAnalysisSettings("basic",
enterprise_slug="my-enterprise",
secret_scanning_enabled_for_new_repositories=True)
# Full security configuration with all features enabled
comprehensive = github.EnterpriseSecurityAnalysisSettings("comprehensive",
enterprise_slug="my-enterprise",
advanced_security_enabled_for_new_repositories=True,
secret_scanning_enabled_for_new_repositories=True,
secret_scanning_push_protection_enabled_for_new_repositories=True,
secret_scanning_validity_checks_enabled=True,
secret_scanning_push_protection_custom_link="https://octokit.com/security-guidelines")
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Basic security settings - enable secret scanning only
_, err := github.NewEnterpriseSecurityAnalysisSettings(ctx, "basic", &github.EnterpriseSecurityAnalysisSettingsArgs{
EnterpriseSlug: pulumi.String("my-enterprise"),
SecretScanningEnabledForNewRepositories: pulumi.Bool(true),
})
if err != nil {
return err
}
// Full security configuration with all features enabled
_, err = github.NewEnterpriseSecurityAnalysisSettings(ctx, "comprehensive", &github.EnterpriseSecurityAnalysisSettingsArgs{
EnterpriseSlug: pulumi.String("my-enterprise"),
AdvancedSecurityEnabledForNewRepositories: pulumi.Bool(true),
SecretScanningEnabledForNewRepositories: pulumi.Bool(true),
SecretScanningPushProtectionEnabledForNewRepositories: pulumi.Bool(true),
SecretScanningValidityChecksEnabled: pulumi.Bool(true),
SecretScanningPushProtectionCustomLink: pulumi.String("https://octokit.com/security-guidelines"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
// Basic security settings - enable secret scanning only
var basic = new Github.EnterpriseSecurityAnalysisSettings("basic", new()
{
EnterpriseSlug = "my-enterprise",
SecretScanningEnabledForNewRepositories = true,
});
// Full security configuration with all features enabled
var comprehensive = new Github.EnterpriseSecurityAnalysisSettings("comprehensive", new()
{
EnterpriseSlug = "my-enterprise",
AdvancedSecurityEnabledForNewRepositories = true,
SecretScanningEnabledForNewRepositories = true,
SecretScanningPushProtectionEnabledForNewRepositories = true,
SecretScanningValidityChecksEnabled = true,
SecretScanningPushProtectionCustomLink = "https://octokit.com/security-guidelines",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.EnterpriseSecurityAnalysisSettings;
import com.pulumi.github.EnterpriseSecurityAnalysisSettingsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Basic security settings - enable secret scanning only
var basic = new EnterpriseSecurityAnalysisSettings("basic", EnterpriseSecurityAnalysisSettingsArgs.builder()
.enterpriseSlug("my-enterprise")
.secretScanningEnabledForNewRepositories(true)
.build());
// Full security configuration with all features enabled
var comprehensive = new EnterpriseSecurityAnalysisSettings("comprehensive", EnterpriseSecurityAnalysisSettingsArgs.builder()
.enterpriseSlug("my-enterprise")
.advancedSecurityEnabledForNewRepositories(true)
.secretScanningEnabledForNewRepositories(true)
.secretScanningPushProtectionEnabledForNewRepositories(true)
.secretScanningValidityChecksEnabled(true)
.secretScanningPushProtectionCustomLink("https://octokit.com/security-guidelines")
.build());
}
}
resources:
# Basic security settings - enable secret scanning only
basic:
type: github:EnterpriseSecurityAnalysisSettings
properties:
enterpriseSlug: my-enterprise
secretScanningEnabledForNewRepositories: true
# Full security configuration with all features enabled
comprehensive:
type: github:EnterpriseSecurityAnalysisSettings
properties:
enterpriseSlug: my-enterprise
advancedSecurityEnabledForNewRepositories: true
secretScanningEnabledForNewRepositories: true
secretScanningPushProtectionEnabledForNewRepositories: true
secretScanningValidityChecksEnabled: true
secretScanningPushProtectionCustomLink: https://octokit.com/security-guidelines
Notes
Note: This resource requires a GitHub Enterprise account and enterprise admin permissions.
Note: Advanced Security features require a GitHub Advanced Security license.
When this resource is destroyed, all security analysis settings will be reset to disabled defaults for security reasons.
Dependencies
This resource manages the following security features:
- Advanced Security: Code scanning, secret scanning, and dependency review
- Secret Scanning: Automatic detection of secrets in code
- Push Protection: Prevents secrets from being committed to repositories
- Validity Checks: Verifies that detected secrets are actually valid
These settings only apply to new repositories created after the settings are enabled. Existing repositories are not affected and must be configured individually.
Create EnterpriseSecurityAnalysisSettings Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EnterpriseSecurityAnalysisSettings(name: string, args: EnterpriseSecurityAnalysisSettingsArgs, opts?: CustomResourceOptions);@overload
def EnterpriseSecurityAnalysisSettings(resource_name: str,
args: EnterpriseSecurityAnalysisSettingsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EnterpriseSecurityAnalysisSettings(resource_name: str,
opts: Optional[ResourceOptions] = None,
enterprise_slug: Optional[str] = None,
advanced_security_enabled_for_new_repositories: Optional[bool] = None,
secret_scanning_enabled_for_new_repositories: Optional[bool] = None,
secret_scanning_push_protection_custom_link: Optional[str] = None,
secret_scanning_push_protection_enabled_for_new_repositories: Optional[bool] = None,
secret_scanning_validity_checks_enabled: Optional[bool] = None)func NewEnterpriseSecurityAnalysisSettings(ctx *Context, name string, args EnterpriseSecurityAnalysisSettingsArgs, opts ...ResourceOption) (*EnterpriseSecurityAnalysisSettings, error)public EnterpriseSecurityAnalysisSettings(string name, EnterpriseSecurityAnalysisSettingsArgs args, CustomResourceOptions? opts = null)
public EnterpriseSecurityAnalysisSettings(String name, EnterpriseSecurityAnalysisSettingsArgs args)
public EnterpriseSecurityAnalysisSettings(String name, EnterpriseSecurityAnalysisSettingsArgs args, CustomResourceOptions options)
type: github:EnterpriseSecurityAnalysisSettings
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args EnterpriseSecurityAnalysisSettingsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args EnterpriseSecurityAnalysisSettingsArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args EnterpriseSecurityAnalysisSettingsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EnterpriseSecurityAnalysisSettingsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EnterpriseSecurityAnalysisSettingsArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var enterpriseSecurityAnalysisSettingsResource = new Github.EnterpriseSecurityAnalysisSettings("enterpriseSecurityAnalysisSettingsResource", new()
{
EnterpriseSlug = "string",
AdvancedSecurityEnabledForNewRepositories = false,
SecretScanningEnabledForNewRepositories = false,
SecretScanningPushProtectionCustomLink = "string",
SecretScanningPushProtectionEnabledForNewRepositories = false,
SecretScanningValidityChecksEnabled = false,
});
example, err := github.NewEnterpriseSecurityAnalysisSettings(ctx, "enterpriseSecurityAnalysisSettingsResource", &github.EnterpriseSecurityAnalysisSettingsArgs{
EnterpriseSlug: pulumi.String("string"),
AdvancedSecurityEnabledForNewRepositories: pulumi.Bool(false),
SecretScanningEnabledForNewRepositories: pulumi.Bool(false),
SecretScanningPushProtectionCustomLink: pulumi.String("string"),
SecretScanningPushProtectionEnabledForNewRepositories: pulumi.Bool(false),
SecretScanningValidityChecksEnabled: pulumi.Bool(false),
})
var enterpriseSecurityAnalysisSettingsResource = new EnterpriseSecurityAnalysisSettings("enterpriseSecurityAnalysisSettingsResource", EnterpriseSecurityAnalysisSettingsArgs.builder()
.enterpriseSlug("string")
.advancedSecurityEnabledForNewRepositories(false)
.secretScanningEnabledForNewRepositories(false)
.secretScanningPushProtectionCustomLink("string")
.secretScanningPushProtectionEnabledForNewRepositories(false)
.secretScanningValidityChecksEnabled(false)
.build());
enterprise_security_analysis_settings_resource = github.EnterpriseSecurityAnalysisSettings("enterpriseSecurityAnalysisSettingsResource",
enterprise_slug="string",
advanced_security_enabled_for_new_repositories=False,
secret_scanning_enabled_for_new_repositories=False,
secret_scanning_push_protection_custom_link="string",
secret_scanning_push_protection_enabled_for_new_repositories=False,
secret_scanning_validity_checks_enabled=False)
const enterpriseSecurityAnalysisSettingsResource = new github.EnterpriseSecurityAnalysisSettings("enterpriseSecurityAnalysisSettingsResource", {
enterpriseSlug: "string",
advancedSecurityEnabledForNewRepositories: false,
secretScanningEnabledForNewRepositories: false,
secretScanningPushProtectionCustomLink: "string",
secretScanningPushProtectionEnabledForNewRepositories: false,
secretScanningValidityChecksEnabled: false,
});
type: github:EnterpriseSecurityAnalysisSettings
properties:
advancedSecurityEnabledForNewRepositories: false
enterpriseSlug: string
secretScanningEnabledForNewRepositories: false
secretScanningPushProtectionCustomLink: string
secretScanningPushProtectionEnabledForNewRepositories: false
secretScanningValidityChecksEnabled: false
EnterpriseSecurityAnalysisSettings Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The EnterpriseSecurityAnalysisSettings resource accepts the following input properties:
- Enterprise
Slug string - The slug of the enterprise.
- Advanced
Security boolEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - Secret
Scanning boolEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- Secret
Scanning boolPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning boolValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- Enterprise
Slug string - The slug of the enterprise.
- Advanced
Security boolEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - Secret
Scanning boolEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- Secret
Scanning boolPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning boolValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- enterprise
Slug String - The slug of the enterprise.
- advanced
Security BooleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - secret
Scanning BooleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning StringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning BooleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning BooleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- enterprise
Slug string - The slug of the enterprise.
- advanced
Security booleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - secret
Scanning booleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning booleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning booleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- enterprise_
slug str - The slug of the enterprise.
- advanced_
security_ boolenabled_ for_ new_ repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - secret_
scanning_ boolenabled_ for_ new_ repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret_
scanning_ strpush_ protection_ custom_ link - Custom URL for secret scanning push protection bypass instructions.
- secret_
scanning_ boolpush_ protection_ enabled_ for_ new_ repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret_
scanning_ boolvalidity_ checks_ enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- enterprise
Slug String - The slug of the enterprise.
- advanced
Security BooleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - secret
Scanning BooleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning StringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning BooleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning BooleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
Outputs
All input properties are implicitly available as output properties. Additionally, the EnterpriseSecurityAnalysisSettings resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EnterpriseSecurityAnalysisSettings Resource
Get an existing EnterpriseSecurityAnalysisSettings resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: EnterpriseSecurityAnalysisSettingsState, opts?: CustomResourceOptions): EnterpriseSecurityAnalysisSettings@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
advanced_security_enabled_for_new_repositories: Optional[bool] = None,
enterprise_slug: Optional[str] = None,
secret_scanning_enabled_for_new_repositories: Optional[bool] = None,
secret_scanning_push_protection_custom_link: Optional[str] = None,
secret_scanning_push_protection_enabled_for_new_repositories: Optional[bool] = None,
secret_scanning_validity_checks_enabled: Optional[bool] = None) -> EnterpriseSecurityAnalysisSettingsfunc GetEnterpriseSecurityAnalysisSettings(ctx *Context, name string, id IDInput, state *EnterpriseSecurityAnalysisSettingsState, opts ...ResourceOption) (*EnterpriseSecurityAnalysisSettings, error)public static EnterpriseSecurityAnalysisSettings Get(string name, Input<string> id, EnterpriseSecurityAnalysisSettingsState? state, CustomResourceOptions? opts = null)public static EnterpriseSecurityAnalysisSettings get(String name, Output<String> id, EnterpriseSecurityAnalysisSettingsState state, CustomResourceOptions options)resources: _: type: github:EnterpriseSecurityAnalysisSettings get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Advanced
Security boolEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - Enterprise
Slug string - The slug of the enterprise.
- Secret
Scanning boolEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- Secret
Scanning boolPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning boolValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- Advanced
Security boolEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - Enterprise
Slug string - The slug of the enterprise.
- Secret
Scanning boolEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- Secret
Scanning boolPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - Secret
Scanning boolValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- advanced
Security BooleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - enterprise
Slug String - The slug of the enterprise.
- secret
Scanning BooleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning StringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning BooleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning BooleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- advanced
Security booleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - enterprise
Slug string - The slug of the enterprise.
- secret
Scanning booleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning stringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning booleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning booleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- advanced_
security_ boolenabled_ for_ new_ repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - enterprise_
slug str - The slug of the enterprise.
- secret_
scanning_ boolenabled_ for_ new_ repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret_
scanning_ strpush_ protection_ custom_ link - Custom URL for secret scanning push protection bypass instructions.
- secret_
scanning_ boolpush_ protection_ enabled_ for_ new_ repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret_
scanning_ boolvalidity_ checks_ enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
- advanced
Security BooleanEnabled For New Repositories - Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to
false. Requires Advanced Security license. - enterprise
Slug String - The slug of the enterprise.
- secret
Scanning BooleanEnabled For New Repositories - Whether secret scanning is automatically enabled for new repositories. Defaults to
false. - secret
Scanning StringPush Protection Custom Link - Custom URL for secret scanning push protection bypass instructions.
- secret
Scanning BooleanPush Protection Enabled For New Repositories - Whether secret scanning push protection is automatically enabled for new repositories. Defaults to
false. - secret
Scanning BooleanValidity Checks Enabled - Whether secret scanning validity checks are enabled. Defaults to
false.
Import
Enterprise security analysis settings can be imported using the enterprise slug:
$ pulumi import github:index/enterpriseSecurityAnalysisSettings:EnterpriseSecurityAnalysisSettings example my-enterprise
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
githubTerraform Provider.
