We recommend using Azure Native.
azure.containerservice.RegistryCacheRule
Explore with Pulumi AI
Manages an Azure Container Registry Cache Rule.
Note: All arguments including the access key will be stored in the raw state as plain-text. Read more about sensitive data in state.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const acr = new azure.containerservice.Registry("acr", {
name: "containerRegistry1",
resourceGroupName: example.name,
location: example.location,
sku: "Basic",
});
const cacheRule = new azure.containerservice.RegistryCacheRule("cache_rule", {
name: "cacherule",
containerRegistryId: acr.id,
targetRepo: "target",
sourceRepo: "docker.io/hello-world",
credentialSetId: pulumi.interpolate`${acr.id}/credentialSets/example`,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
acr = azure.containerservice.Registry("acr",
name="containerRegistry1",
resource_group_name=example.name,
location=example.location,
sku="Basic")
cache_rule = azure.containerservice.RegistryCacheRule("cache_rule",
name="cacherule",
container_registry_id=acr.id,
target_repo="target",
source_repo="docker.io/hello-world",
credential_set_id=acr.id.apply(lambda id: f"{id}/credentialSets/example"))
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/containerservice"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
acr, err := containerservice.NewRegistry(ctx, "acr", &containerservice.RegistryArgs{
Name: pulumi.String("containerRegistry1"),
ResourceGroupName: example.Name,
Location: example.Location,
Sku: pulumi.String("Basic"),
})
if err != nil {
return err
}
_, err = containerservice.NewRegistryCacheRule(ctx, "cache_rule", &containerservice.RegistryCacheRuleArgs{
Name: pulumi.String("cacherule"),
ContainerRegistryId: acr.ID(),
TargetRepo: pulumi.String("target"),
SourceRepo: pulumi.String("docker.io/hello-world"),
CredentialSetId: acr.ID().ApplyT(func(id string) (string, error) {
return fmt.Sprintf("%v/credentialSets/example", id), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var acr = new Azure.ContainerService.Registry("acr", new()
{
Name = "containerRegistry1",
ResourceGroupName = example.Name,
Location = example.Location,
Sku = "Basic",
});
var cacheRule = new Azure.ContainerService.RegistryCacheRule("cache_rule", new()
{
Name = "cacherule",
ContainerRegistryId = acr.Id,
TargetRepo = "target",
SourceRepo = "docker.io/hello-world",
CredentialSetId = acr.Id.Apply(id => $"{id}/credentialSets/example"),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.containerservice.Registry;
import com.pulumi.azure.containerservice.RegistryArgs;
import com.pulumi.azure.containerservice.RegistryCacheRule;
import com.pulumi.azure.containerservice.RegistryCacheRuleArgs;
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 ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var acr = new Registry("acr", RegistryArgs.builder()
.name("containerRegistry1")
.resourceGroupName(example.name())
.location(example.location())
.sku("Basic")
.build());
var cacheRule = new RegistryCacheRule("cacheRule", RegistryCacheRuleArgs.builder()
.name("cacherule")
.containerRegistryId(acr.id())
.targetRepo("target")
.sourceRepo("docker.io/hello-world")
.credentialSetId(acr.id().applyValue(id -> String.format("%s/credentialSets/example", id)))
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
acr:
type: azure:containerservice:Registry
properties:
name: containerRegistry1
resourceGroupName: ${example.name}
location: ${example.location}
sku: Basic
cacheRule:
type: azure:containerservice:RegistryCacheRule
name: cache_rule
properties:
name: cacherule
containerRegistryId: ${acr.id}
targetRepo: target
sourceRepo: docker.io/hello-world
credentialSetId: ${acr.id}/credentialSets/example
Create RegistryCacheRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RegistryCacheRule(name: string, args: RegistryCacheRuleArgs, opts?: CustomResourceOptions);
@overload
def RegistryCacheRule(resource_name: str,
args: RegistryCacheRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RegistryCacheRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
container_registry_id: Optional[str] = None,
source_repo: Optional[str] = None,
target_repo: Optional[str] = None,
credential_set_id: Optional[str] = None,
name: Optional[str] = None)
func NewRegistryCacheRule(ctx *Context, name string, args RegistryCacheRuleArgs, opts ...ResourceOption) (*RegistryCacheRule, error)
public RegistryCacheRule(string name, RegistryCacheRuleArgs args, CustomResourceOptions? opts = null)
public RegistryCacheRule(String name, RegistryCacheRuleArgs args)
public RegistryCacheRule(String name, RegistryCacheRuleArgs args, CustomResourceOptions options)
type: azure:containerservice:RegistryCacheRule
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 RegistryCacheRuleArgs
- 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 RegistryCacheRuleArgs
- 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 RegistryCacheRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RegistryCacheRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RegistryCacheRuleArgs
- 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 registryCacheRuleResource = new Azure.ContainerService.RegistryCacheRule("registryCacheRuleResource", new()
{
ContainerRegistryId = "string",
SourceRepo = "string",
TargetRepo = "string",
CredentialSetId = "string",
Name = "string",
});
example, err := containerservice.NewRegistryCacheRule(ctx, "registryCacheRuleResource", &containerservice.RegistryCacheRuleArgs{
ContainerRegistryId: pulumi.String("string"),
SourceRepo: pulumi.String("string"),
TargetRepo: pulumi.String("string"),
CredentialSetId: pulumi.String("string"),
Name: pulumi.String("string"),
})
var registryCacheRuleResource = new RegistryCacheRule("registryCacheRuleResource", RegistryCacheRuleArgs.builder()
.containerRegistryId("string")
.sourceRepo("string")
.targetRepo("string")
.credentialSetId("string")
.name("string")
.build());
registry_cache_rule_resource = azure.containerservice.RegistryCacheRule("registryCacheRuleResource",
container_registry_id="string",
source_repo="string",
target_repo="string",
credential_set_id="string",
name="string")
const registryCacheRuleResource = new azure.containerservice.RegistryCacheRule("registryCacheRuleResource", {
containerRegistryId: "string",
sourceRepo: "string",
targetRepo: "string",
credentialSetId: "string",
name: "string",
});
type: azure:containerservice:RegistryCacheRule
properties:
containerRegistryId: string
credentialSetId: string
name: string
sourceRepo: string
targetRepo: string
RegistryCacheRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The RegistryCacheRule resource accepts the following input properties:
- Container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- Source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- Target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- Credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- Name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- Container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- Source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- Target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- Credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- Name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- container
Registry StringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- source
Repo String - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo String - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- credential
Set StringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name String
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- container_
registry_ strid - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- source_
repo str - The name of the source repository path. Changing this forces a new resource to be created.
- target_
repo str - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- credential_
set_ strid - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name str
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- container
Registry StringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- source
Repo String - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo String - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- credential
Set StringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name String
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the RegistryCacheRule 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 RegistryCacheRule Resource
Get an existing RegistryCacheRule 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?: RegistryCacheRuleState, opts?: CustomResourceOptions): RegistryCacheRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
container_registry_id: Optional[str] = None,
credential_set_id: Optional[str] = None,
name: Optional[str] = None,
source_repo: Optional[str] = None,
target_repo: Optional[str] = None) -> RegistryCacheRule
func GetRegistryCacheRule(ctx *Context, name string, id IDInput, state *RegistryCacheRuleState, opts ...ResourceOption) (*RegistryCacheRule, error)
public static RegistryCacheRule Get(string name, Input<string> id, RegistryCacheRuleState? state, CustomResourceOptions? opts = null)
public static RegistryCacheRule get(String name, Output<String> id, RegistryCacheRuleState 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.
- Container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- Credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- Name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- Source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- Target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- Container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- Credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- Name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- Source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- Target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- container
Registry StringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- credential
Set StringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name String
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- source
Repo String - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo String - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- container
Registry stringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- credential
Set stringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name string
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- source
Repo string - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo string - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- container_
registry_ strid - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- credential_
set_ strid - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name str
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- source_
repo str - The name of the source repository path. Changing this forces a new resource to be created.
- target_
repo str - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
- container
Registry StringId - The ID of the Container Registry where the Cache Rule should apply. Changing this forces a new resource to be created.
- credential
Set StringId - The ARM resource ID of the Credential Store which is associated with the Cache Rule.
- name String
- Specifies the name of the Container Registry Cache Rule. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
- source
Repo String - The name of the source repository path. Changing this forces a new resource to be created.
- target
Repo String - The name of the new repository path to store artifacts. Changing this forces a new resource to be created.
Import
Container Registry Cache Rules can be imported using the resource id
, e.g.
$ pulumi import azure:containerservice/registryCacheRule:RegistryCacheRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/cacheRules/myCacheRule
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.