published on Friday, Oct 16, 2026 by Pulumi
published on Friday, Oct 16, 2026 by Pulumi
The gitlab.ProjectContainerScanning resource allows managing whether container scanning for registry is enabled on a project.
This resource requires a GitLab Ultimate license, and is available on GitLab.com, GitLab Self-Managed, and GitLab Dedicated.
Container scanning for registry automatically scans container images pushed to the project’s container registry with the
latesttag.
Using multiple
gitlab.ProjectContainerScanningresources for the same project may result in non-deterministic behavior, as each resource will attempt to manage the same setting.
When you destroy the resource, you can control if the container scanning for registry setting is kept or not. Set
keepSettingsOnDestroytotrue(default) to leave the setting as last configured. SetkeepSettingsOnDestroytofalseto reset it to its pre-Terraform value. The original value is saved in state when you create or import the resource. You can change thekeepSettingsOnDestroyvalue before destroying the resource to control this behavior.
Upstream API: GitLab GraphQL API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = new gitlab.Project("example", {name: "example"});
const exampleProjectContainerScanning = new gitlab.ProjectContainerScanning("example", {
project: example.id,
containerScanningForRegistryEnabled: true,
});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.Project("example", name="example")
example_project_container_scanning = gitlab.ProjectContainerScanning("example",
project=example.id,
container_scanning_for_registry_enabled=True)
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v10/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := gitlab.NewProject(ctx, "example", &gitlab.ProjectArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = gitlab.NewProjectContainerScanning(ctx, "example", &gitlab.ProjectContainerScanningArgs{
Project: example.ID().ToIDOutput().ToStringOutput(),
ContainerScanningForRegistryEnabled: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var example = new GitLab.Project("example", new()
{
Name = "example",
});
var exampleProjectContainerScanning = new GitLab.ProjectContainerScanning("example", new()
{
Project = example.Id,
ContainerScanningForRegistryEnabled = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.ProjectContainerScanning;
import com.pulumi.gitlab.ProjectContainerScanningArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
var example = new Project("example", ProjectArgs.builder()
.name("example")
.build());
var exampleProjectContainerScanning = new ProjectContainerScanning("exampleProjectContainerScanning", ProjectContainerScanningArgs.builder()
.project(example.id())
.containerScanningForRegistryEnabled(true)
.build());
}
}
resources:
example:
type: gitlab:Project
properties:
name: example
exampleProjectContainerScanning:
type: gitlab:ProjectContainerScanning
name: example
properties:
project: ${example.id}
containerScanningForRegistryEnabled: true
terraform {
required_providers {
gitlab = {
source = "pulumi/gitlab"
}
}
}
resource "gitlab_project" "example" {
lifecycle {
create_before_destroy = true
}
name = "example"
}
resource "gitlab_project_container_scanning" "example" {
lifecycle {
create_before_destroy = true
}
project = gitlab_project.example.id
container_scanning_for_registry_enabled = true
}
Create ProjectContainerScanning Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectContainerScanning(name: string, args: ProjectContainerScanningArgs, opts?: CustomResourceOptions);@overload
def ProjectContainerScanning(resource_name: str,
args: ProjectContainerScanningArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectContainerScanning(resource_name: str,
opts: Optional[ResourceOptions] = None,
container_scanning_for_registry_enabled: Optional[bool] = None,
project: Optional[str] = None,
keep_settings_on_destroy: Optional[bool] = None)func NewProjectContainerScanning(ctx *Context, name string, args ProjectContainerScanningArgs, opts ...ResourceOption) (*ProjectContainerScanning, error)public ProjectContainerScanning(string name, ProjectContainerScanningArgs args, CustomResourceOptions? opts = null)
public ProjectContainerScanning(String name, ProjectContainerScanningArgs args)
public ProjectContainerScanning(String name, ProjectContainerScanningArgs args, CustomResourceOptions options)
type: gitlab:ProjectContainerScanning
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "gitlab_project_container_scanning" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args ProjectContainerScanningArgs
- 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 ProjectContainerScanningArgs
- 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 ProjectContainerScanningArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectContainerScanningArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectContainerScanningArgs
- 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 projectContainerScanningResource = new GitLab.ProjectContainerScanning("projectContainerScanningResource", new()
{
ContainerScanningForRegistryEnabled = false,
Project = "string",
KeepSettingsOnDestroy = false,
});
example, err := gitlab.NewProjectContainerScanning(ctx, "projectContainerScanningResource", &gitlab.ProjectContainerScanningArgs{
ContainerScanningForRegistryEnabled: pulumi.Bool(false),
Project: pulumi.String("string"),
KeepSettingsOnDestroy: pulumi.Bool(false),
})
resource "gitlab_project_container_scanning" "projectContainerScanningResource" {
lifecycle {
create_before_destroy = true
}
container_scanning_for_registry_enabled = false
project = "string"
keep_settings_on_destroy = false
}
var projectContainerScanningResource = new ProjectContainerScanning("projectContainerScanningResource", ProjectContainerScanningArgs.builder()
.containerScanningForRegistryEnabled(false)
.project("string")
.keepSettingsOnDestroy(false)
.build());
project_container_scanning_resource = gitlab.ProjectContainerScanning("projectContainerScanningResource",
container_scanning_for_registry_enabled=False,
project="string",
keep_settings_on_destroy=False)
const projectContainerScanningResource = new gitlab.ProjectContainerScanning("projectContainerScanningResource", {
containerScanningForRegistryEnabled: false,
project: "string",
keepSettingsOnDestroy: false,
});
type: gitlab:ProjectContainerScanning
properties:
containerScanningForRegistryEnabled: false
keepSettingsOnDestroy: false
project: string
ProjectContainerScanning 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 ProjectContainerScanning resource accepts the following input properties:
- Container
Scanning boolFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- Project string
- The ID or full path of the project to change the container scanning for registry setting of.
- Keep
Settings boolOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- Container
Scanning boolFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- Project string
- The ID or full path of the project to change the container scanning for registry setting of.
- Keep
Settings boolOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- container_
scanning_ boolfor_ registry_ enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- project string
- The ID or full path of the project to change the container scanning for registry setting of.
- keep_
settings_ boolon_ destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- container
Scanning BooleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- project String
- The ID or full path of the project to change the container scanning for registry setting of.
- keep
Settings BooleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- container
Scanning booleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- project string
- The ID or full path of the project to change the container scanning for registry setting of.
- keep
Settings booleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- container_
scanning_ boolfor_ registry_ enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- project str
- The ID or full path of the project to change the container scanning for registry setting of.
- keep_
settings_ boolon_ destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
- container
Scanning BooleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- project String
- The ID or full path of the project to change the container scanning for registry setting of.
- keep
Settings BooleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectContainerScanning 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 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 ProjectContainerScanning Resource
Get an existing ProjectContainerScanning 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?: ProjectContainerScanningState, opts?: CustomResourceOptions): ProjectContainerScanning@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
container_scanning_for_registry_enabled: Optional[bool] = None,
keep_settings_on_destroy: Optional[bool] = None,
project: Optional[str] = None) -> ProjectContainerScanningfunc GetProjectContainerScanning(ctx *Context, name string, id IDInput, state *ProjectContainerScanningState, opts ...ResourceOption) (*ProjectContainerScanning, error)public static ProjectContainerScanning Get(string name, Input<string> id, ProjectContainerScanningState? state, CustomResourceOptions? opts = null)public static ProjectContainerScanning get(String name, Output<String> id, ProjectContainerScanningState state, CustomResourceOptions options)resources: _: type: gitlab:ProjectContainerScanning get: id: ${id}import {
to = gitlab_project_container_scanning.example
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.
- Container
Scanning boolFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- Keep
Settings boolOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - Project string
- The ID or full path of the project to change the container scanning for registry setting of.
- Container
Scanning boolFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- Keep
Settings boolOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - Project string
- The ID or full path of the project to change the container scanning for registry setting of.
- container_
scanning_ boolfor_ registry_ enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- keep_
settings_ boolon_ destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - project string
- The ID or full path of the project to change the container scanning for registry setting of.
- container
Scanning BooleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- keep
Settings BooleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - project String
- The ID or full path of the project to change the container scanning for registry setting of.
- container
Scanning booleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- keep
Settings booleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - project string
- The ID or full path of the project to change the container scanning for registry setting of.
- container_
scanning_ boolfor_ registry_ enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- keep_
settings_ boolon_ destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - project str
- The ID or full path of the project to change the container scanning for registry setting of.
- container
Scanning BooleanFor Registry Enabled - Whether to enable container scanning for registry for the project. Requires a GitLab Ultimate license.
- keep
Settings BooleanOn Destroy - Set to
trueif the container scanning for registry setting should not be reset to its pre-Terraform value on destroy. - project String
- The ID or full path of the project to change the container scanning for registry setting of.
Import
Starting in Terraform v1.5.0, you can use an import block to import gitlab.ProjectContainerScanning. For example:
Importing using the CLI is supported with the following syntax:
GitLab project container scanning for registry settings can be imported using the project ID or full path, e.g.
$ pulumi import gitlab:index/projectContainerScanning:ProjectContainerScanning example "12345"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlabTerraform Provider.
published on Friday, Oct 16, 2026 by Pulumi