digitalocean.ContainerRegistryDockerCredentials
Explore with Pulumi AI
Get Docker credentials for your DigitalOcean container registry.
An error is triggered if the provided container registry name does not exist.
Example Usage
Basic Example
Get the container registry:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = new digitalocean.ContainerRegistryDockerCredentials("example", {registryName: "example"});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.ContainerRegistryDockerCredentials("example", registry_name="example")
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := digitalocean.NewContainerRegistryDockerCredentials(ctx, "example", &digitalocean.ContainerRegistryDockerCredentialsArgs{
RegistryName: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = new DigitalOcean.ContainerRegistryDockerCredentials("example", new()
{
RegistryName = "example",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentials;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentialsArgs;
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) {
var example = new ContainerRegistryDockerCredentials("example", ContainerRegistryDockerCredentialsArgs.builder()
.registryName("example")
.build());
}
}
resources:
example:
type: digitalocean:ContainerRegistryDockerCredentials
properties:
registryName: example
Docker Provider Example
Use the endpoint
and docker_credentials
with the Docker provider:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = digitalocean.getContainerRegistry({
name: "example",
});
const exampleContainerRegistryDockerCredentials = new digitalocean.ContainerRegistryDockerCredentials("example", {registryName: "example"});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.get_container_registry(name="example")
example_container_registry_docker_credentials = digitalocean.ContainerRegistryDockerCredentials("example", registry_name="example")
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := digitalocean.LookupContainerRegistry(ctx, &digitalocean.LookupContainerRegistryArgs{
Name: "example",
}, nil)
if err != nil {
return err
}
_, err = digitalocean.NewContainerRegistryDockerCredentials(ctx, "example", &digitalocean.ContainerRegistryDockerCredentialsArgs{
RegistryName: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = DigitalOcean.GetContainerRegistry.Invoke(new()
{
Name = "example",
});
var exampleContainerRegistryDockerCredentials = new DigitalOcean.ContainerRegistryDockerCredentials("example", new()
{
RegistryName = "example",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetContainerRegistryArgs;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentials;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentialsArgs;
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) {
final var example = DigitaloceanFunctions.getContainerRegistry(GetContainerRegistryArgs.builder()
.name("example")
.build());
var exampleContainerRegistryDockerCredentials = new ContainerRegistryDockerCredentials("exampleContainerRegistryDockerCredentials", ContainerRegistryDockerCredentialsArgs.builder()
.registryName("example")
.build());
}
}
resources:
exampleContainerRegistryDockerCredentials:
type: digitalocean:ContainerRegistryDockerCredentials
name: example
properties:
registryName: example
variables:
example:
fn::invoke:
Function: digitalocean:getContainerRegistry
Arguments:
name: example
Kubernetes Example
Combined with the Kubernetes Provider’s kubernetes_secret
resource, you can
access the registry from inside your cluster:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
import * as kubernetes from "@pulumi/kubernetes";
const exampleContainerRegistryDockerCredentials = new digitalocean.ContainerRegistryDockerCredentials("example", {registryName: "example"});
const example = digitalocean.getKubernetesCluster({
name: "prod-cluster-01",
});
const exampleSecret = new kubernetes.core.v1.Secret("example", {
metadata: {
name: "docker-cfg",
},
data: {
".dockerconfigjson": exampleContainerRegistryDockerCredentials.dockerCredentials,
},
type: "kubernetes.io/dockerconfigjson",
});
import pulumi
import pulumi_digitalocean as digitalocean
import pulumi_kubernetes as kubernetes
example_container_registry_docker_credentials = digitalocean.ContainerRegistryDockerCredentials("example", registry_name="example")
example = digitalocean.get_kubernetes_cluster(name="prod-cluster-01")
example_secret = kubernetes.core.v1.Secret("example",
metadata={
"name": "docker-cfg",
},
data={
".dockerconfigjson": example_container_registry_docker_credentials.docker_credentials,
},
type="kubernetes.io/dockerconfigjson")
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleContainerRegistryDockerCredentials, err := digitalocean.NewContainerRegistryDockerCredentials(ctx, "example", &digitalocean.ContainerRegistryDockerCredentialsArgs{
RegistryName: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = digitalocean.LookupKubernetesCluster(ctx, &digitalocean.LookupKubernetesClusterArgs{
Name: "prod-cluster-01",
}, nil)
if err != nil {
return err
}
_, err = corev1.NewSecret(ctx, "example", &corev1.SecretArgs{
Metadata: &metav1.ObjectMetaArgs{
Name: pulumi.String("docker-cfg"),
},
Data: pulumi.StringMap{
".dockerconfigjson": exampleContainerRegistryDockerCredentials.DockerCredentials,
},
Type: pulumi.String("kubernetes.io/dockerconfigjson"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
using Kubernetes = Pulumi.Kubernetes;
return await Deployment.RunAsync(() =>
{
var exampleContainerRegistryDockerCredentials = new DigitalOcean.ContainerRegistryDockerCredentials("example", new()
{
RegistryName = "example",
});
var example = DigitalOcean.GetKubernetesCluster.Invoke(new()
{
Name = "prod-cluster-01",
});
var exampleSecret = new Kubernetes.Core.V1.Secret("example", new()
{
Metadata = new Kubernetes.Types.Inputs.Meta.V1.ObjectMetaArgs
{
Name = "docker-cfg",
},
Data =
{
{ ".dockerconfigjson", exampleContainerRegistryDockerCredentials.DockerCredentials },
},
Type = "kubernetes.io/dockerconfigjson",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentials;
import com.pulumi.digitalocean.ContainerRegistryDockerCredentialsArgs;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetKubernetesClusterArgs;
import com.pulumi.kubernetes.core_v1.Secret;
import com.pulumi.kubernetes.core_v1.SecretArgs;
import com.pulumi.kubernetes.meta_v1.inputs.ObjectMetaArgs;
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) {
var exampleContainerRegistryDockerCredentials = new ContainerRegistryDockerCredentials("exampleContainerRegistryDockerCredentials", ContainerRegistryDockerCredentialsArgs.builder()
.registryName("example")
.build());
final var example = DigitaloceanFunctions.getKubernetesCluster(GetKubernetesClusterArgs.builder()
.name("prod-cluster-01")
.build());
var exampleSecret = new Secret("exampleSecret", SecretArgs.builder()
.metadata(ObjectMetaArgs.builder()
.name("docker-cfg")
.build())
.data(Map.of(".dockerconfigjson", exampleContainerRegistryDockerCredentials.dockerCredentials()))
.type("kubernetes.io/dockerconfigjson")
.build());
}
}
resources:
exampleContainerRegistryDockerCredentials:
type: digitalocean:ContainerRegistryDockerCredentials
name: example
properties:
registryName: example
exampleSecret:
type: kubernetes:core/v1:Secret
name: example
properties:
metadata:
name: docker-cfg
data:
.dockerconfigjson: ${exampleContainerRegistryDockerCredentials.dockerCredentials}
type: kubernetes.io/dockerconfigjson
variables:
example:
fn::invoke:
Function: digitalocean:getKubernetesCluster
Arguments:
name: prod-cluster-01
Create ContainerRegistryDockerCredentials Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ContainerRegistryDockerCredentials(name: string, args: ContainerRegistryDockerCredentialsArgs, opts?: CustomResourceOptions);
@overload
def ContainerRegistryDockerCredentials(resource_name: str,
args: ContainerRegistryDockerCredentialsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ContainerRegistryDockerCredentials(resource_name: str,
opts: Optional[ResourceOptions] = None,
registry_name: Optional[str] = None,
expiry_seconds: Optional[int] = None,
write: Optional[bool] = None)
func NewContainerRegistryDockerCredentials(ctx *Context, name string, args ContainerRegistryDockerCredentialsArgs, opts ...ResourceOption) (*ContainerRegistryDockerCredentials, error)
public ContainerRegistryDockerCredentials(string name, ContainerRegistryDockerCredentialsArgs args, CustomResourceOptions? opts = null)
public ContainerRegistryDockerCredentials(String name, ContainerRegistryDockerCredentialsArgs args)
public ContainerRegistryDockerCredentials(String name, ContainerRegistryDockerCredentialsArgs args, CustomResourceOptions options)
type: digitalocean:ContainerRegistryDockerCredentials
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 ContainerRegistryDockerCredentialsArgs
- 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 ContainerRegistryDockerCredentialsArgs
- 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 ContainerRegistryDockerCredentialsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ContainerRegistryDockerCredentialsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ContainerRegistryDockerCredentialsArgs
- 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 containerRegistryDockerCredentialsResource = new DigitalOcean.ContainerRegistryDockerCredentials("containerRegistryDockerCredentialsResource", new()
{
RegistryName = "string",
ExpirySeconds = 0,
Write = false,
});
example, err := digitalocean.NewContainerRegistryDockerCredentials(ctx, "containerRegistryDockerCredentialsResource", &digitalocean.ContainerRegistryDockerCredentialsArgs{
RegistryName: pulumi.String("string"),
ExpirySeconds: pulumi.Int(0),
Write: pulumi.Bool(false),
})
var containerRegistryDockerCredentialsResource = new ContainerRegistryDockerCredentials("containerRegistryDockerCredentialsResource", ContainerRegistryDockerCredentialsArgs.builder()
.registryName("string")
.expirySeconds(0)
.write(false)
.build());
container_registry_docker_credentials_resource = digitalocean.ContainerRegistryDockerCredentials("containerRegistryDockerCredentialsResource",
registry_name="string",
expiry_seconds=0,
write=False)
const containerRegistryDockerCredentialsResource = new digitalocean.ContainerRegistryDockerCredentials("containerRegistryDockerCredentialsResource", {
registryName: "string",
expirySeconds: 0,
write: false,
});
type: digitalocean:ContainerRegistryDockerCredentials
properties:
expirySeconds: 0
registryName: string
write: false
ContainerRegistryDockerCredentials 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 ContainerRegistryDockerCredentials resource accepts the following input properties:
- Registry
Name string - The name of the container registry.
- Expiry
Seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- Write bool
- Allow for write access to the container registry. Defaults to false.
- Registry
Name string - The name of the container registry.
- Expiry
Seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- Write bool
- Allow for write access to the container registry. Defaults to false.
- registry
Name String - The name of the container registry.
- expiry
Seconds Integer - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- write Boolean
- Allow for write access to the container registry. Defaults to false.
- registry
Name string - The name of the container registry.
- expiry
Seconds number - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- write boolean
- Allow for write access to the container registry. Defaults to false.
- registry_
name str - The name of the container registry.
- expiry_
seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- write bool
- Allow for write access to the container registry. Defaults to false.
- registry
Name String - The name of the container registry.
- expiry
Seconds Number - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- write Boolean
- Allow for write access to the container registry. Defaults to false.
Outputs
All input properties are implicitly available as output properties. Additionally, the ContainerRegistryDockerCredentials resource produces the following output properties:
- Credential
Expiration stringTime - The date and time the registry access token will expire.
- Docker
Credentials string - Credentials for the container registry.
- Id string
- The provider-assigned unique ID for this managed resource.
- Credential
Expiration stringTime - The date and time the registry access token will expire.
- Docker
Credentials string - Credentials for the container registry.
- Id string
- The provider-assigned unique ID for this managed resource.
- credential
Expiration StringTime - The date and time the registry access token will expire.
- docker
Credentials String - Credentials for the container registry.
- id String
- The provider-assigned unique ID for this managed resource.
- credential
Expiration stringTime - The date and time the registry access token will expire.
- docker
Credentials string - Credentials for the container registry.
- id string
- The provider-assigned unique ID for this managed resource.
- credential_
expiration_ strtime - The date and time the registry access token will expire.
- docker_
credentials str - Credentials for the container registry.
- id str
- The provider-assigned unique ID for this managed resource.
- credential
Expiration StringTime - The date and time the registry access token will expire.
- docker
Credentials String - Credentials for the container registry.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ContainerRegistryDockerCredentials Resource
Get an existing ContainerRegistryDockerCredentials 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?: ContainerRegistryDockerCredentialsState, opts?: CustomResourceOptions): ContainerRegistryDockerCredentials
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
credential_expiration_time: Optional[str] = None,
docker_credentials: Optional[str] = None,
expiry_seconds: Optional[int] = None,
registry_name: Optional[str] = None,
write: Optional[bool] = None) -> ContainerRegistryDockerCredentials
func GetContainerRegistryDockerCredentials(ctx *Context, name string, id IDInput, state *ContainerRegistryDockerCredentialsState, opts ...ResourceOption) (*ContainerRegistryDockerCredentials, error)
public static ContainerRegistryDockerCredentials Get(string name, Input<string> id, ContainerRegistryDockerCredentialsState? state, CustomResourceOptions? opts = null)
public static ContainerRegistryDockerCredentials get(String name, Output<String> id, ContainerRegistryDockerCredentialsState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Credential
Expiration stringTime - The date and time the registry access token will expire.
- Docker
Credentials string - Credentials for the container registry.
- Expiry
Seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- Registry
Name string - The name of the container registry.
- Write bool
- Allow for write access to the container registry. Defaults to false.
- Credential
Expiration stringTime - The date and time the registry access token will expire.
- Docker
Credentials string - Credentials for the container registry.
- Expiry
Seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- Registry
Name string - The name of the container registry.
- Write bool
- Allow for write access to the container registry. Defaults to false.
- credential
Expiration StringTime - The date and time the registry access token will expire.
- docker
Credentials String - Credentials for the container registry.
- expiry
Seconds Integer - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- registry
Name String - The name of the container registry.
- write Boolean
- Allow for write access to the container registry. Defaults to false.
- credential
Expiration stringTime - The date and time the registry access token will expire.
- docker
Credentials string - Credentials for the container registry.
- expiry
Seconds number - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- registry
Name string - The name of the container registry.
- write boolean
- Allow for write access to the container registry. Defaults to false.
- credential_
expiration_ strtime - The date and time the registry access token will expire.
- docker_
credentials str - Credentials for the container registry.
- expiry_
seconds int - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- registry_
name str - The name of the container registry.
- write bool
- Allow for write access to the container registry. Defaults to false.
- credential
Expiration StringTime - The date and time the registry access token will expire.
- docker
Credentials String - Credentials for the container registry.
- expiry
Seconds Number - The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.
- registry
Name String - The name of the container registry.
- write Boolean
- Allow for write access to the container registry. Defaults to false.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.