Manages an AWS ECR (Elastic Container Registry) Pull Time Update Exclusion.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.iam.Role("example", {
name: "example-role",
assumeRolePolicy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Action: "sts:AssumeRole",
Effect: "Allow",
Principal: {
Service: "ec2.amazonaws.com",
},
}],
}),
});
const exampleRolePolicy = new aws.iam.RolePolicy("example", {
name: "example-role-policy",
role: example.id,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Action: [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
],
Resource: "*",
}],
}),
});
const examplePullTimeUpdateExclusion = new aws.ecr.PullTimeUpdateExclusion("example", {principalArn: example.arn});
import pulumi
import json
import pulumi_aws as aws
example = aws.iam.Role("example",
name="example-role",
assume_role_policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com",
},
}],
}))
example_role_policy = aws.iam.RolePolicy("example",
name="example-role-policy",
role=example.id,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
],
"Resource": "*",
}],
}))
example_pull_time_update_exclusion = aws.ecr.PullTimeUpdateExclusion("example", principal_arn=example.arn)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ecr"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": map[string]interface{}{
"Service": "ec2.amazonaws.com",
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
Name: pulumi.String("example-role"),
AssumeRolePolicy: pulumi.String(json0),
})
if err != nil {
return err
}
tmpJSON1, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Effect": "Allow",
"Action": []string{
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
},
"Resource": "*",
},
},
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = iam.NewRolePolicy(ctx, "example", &iam.RolePolicyArgs{
Name: pulumi.String("example-role-policy"),
Role: example.ID(),
Policy: pulumi.String(json1),
})
if err != nil {
return err
}
_, err = ecr.NewPullTimeUpdateExclusion(ctx, "example", &ecr.PullTimeUpdateExclusionArgs{
PrincipalArn: example.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Iam.Role("example", new()
{
Name = "example-role",
AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Action"] = "sts:AssumeRole",
["Effect"] = "Allow",
["Principal"] = new Dictionary<string, object?>
{
["Service"] = "ec2.amazonaws.com",
},
},
},
}),
});
var exampleRolePolicy = new Aws.Iam.RolePolicy("example", new()
{
Name = "example-role-policy",
Role = example.Id,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Effect"] = "Allow",
["Action"] = new[]
{
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
},
["Resource"] = "*",
},
},
}),
});
var examplePullTimeUpdateExclusion = new Aws.Ecr.PullTimeUpdateExclusion("example", new()
{
PrincipalArn = example.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.ecr.PullTimeUpdateExclusion;
import com.pulumi.aws.ecr.PullTimeUpdateExclusionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 Role("example", RoleArgs.builder()
.name("example-role")
.assumeRolePolicy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Action", "sts:AssumeRole"),
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("Service", "ec2.amazonaws.com")
))
)))
)))
.build());
var exampleRolePolicy = new RolePolicy("exampleRolePolicy", RolePolicyArgs.builder()
.name("example-role-policy")
.role(example.id())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Effect", "Allow"),
jsonProperty("Action", jsonArray(
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
)),
jsonProperty("Resource", "*")
)))
)))
.build());
var examplePullTimeUpdateExclusion = new PullTimeUpdateExclusion("examplePullTimeUpdateExclusion", PullTimeUpdateExclusionArgs.builder()
.principalArn(example.arn())
.build());
}
}
resources:
example:
type: aws:iam:Role
properties:
name: example-role
assumeRolePolicy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ec2.amazonaws.com
exampleRolePolicy:
type: aws:iam:RolePolicy
name: example
properties:
name: example-role-policy
role: ${example.id}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- ecr:GetAuthorizationToken
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
Resource: '*'
examplePullTimeUpdateExclusion:
type: aws:ecr:PullTimeUpdateExclusion
name: example
properties:
principalArn: ${example.arn}
With IAM User
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.iam.User("example", {name: "example-user"});
const exampleUserPolicy = new aws.iam.UserPolicy("example", {
name: "example-user-policy",
user: example.name,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Action: [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
],
Resource: "*",
}],
}),
});
const examplePullTimeUpdateExclusion = new aws.ecr.PullTimeUpdateExclusion("example", {principalArn: example.arn});
import pulumi
import json
import pulumi_aws as aws
example = aws.iam.User("example", name="example-user")
example_user_policy = aws.iam.UserPolicy("example",
name="example-user-policy",
user=example.name,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
],
"Resource": "*",
}],
}))
example_pull_time_update_exclusion = aws.ecr.PullTimeUpdateExclusion("example", principal_arn=example.arn)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ecr"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := iam.NewUser(ctx, "example", &iam.UserArgs{
Name: pulumi.String("example-user"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Effect": "Allow",
"Action": []string{
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
},
"Resource": "*",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = iam.NewUserPolicy(ctx, "example", &iam.UserPolicyArgs{
Name: pulumi.String("example-user-policy"),
User: example.Name,
Policy: pulumi.String(json0),
})
if err != nil {
return err
}
_, err = ecr.NewPullTimeUpdateExclusion(ctx, "example", &ecr.PullTimeUpdateExclusionArgs{
PrincipalArn: example.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Iam.User("example", new()
{
Name = "example-user",
});
var exampleUserPolicy = new Aws.Iam.UserPolicy("example", new()
{
Name = "example-user-policy",
User = example.Name,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Effect"] = "Allow",
["Action"] = new[]
{
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
},
["Resource"] = "*",
},
},
}),
});
var examplePullTimeUpdateExclusion = new Aws.Ecr.PullTimeUpdateExclusion("example", new()
{
PrincipalArn = example.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.UserPolicy;
import com.pulumi.aws.iam.UserPolicyArgs;
import com.pulumi.aws.ecr.PullTimeUpdateExclusion;
import com.pulumi.aws.ecr.PullTimeUpdateExclusionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 User("example", UserArgs.builder()
.name("example-user")
.build());
var exampleUserPolicy = new UserPolicy("exampleUserPolicy", UserPolicyArgs.builder()
.name("example-user-policy")
.user(example.name())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Effect", "Allow"),
jsonProperty("Action", jsonArray(
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
)),
jsonProperty("Resource", "*")
)))
)))
.build());
var examplePullTimeUpdateExclusion = new PullTimeUpdateExclusion("examplePullTimeUpdateExclusion", PullTimeUpdateExclusionArgs.builder()
.principalArn(example.arn())
.build());
}
}
resources:
example:
type: aws:iam:User
properties:
name: example-user
exampleUserPolicy:
type: aws:iam:UserPolicy
name: example
properties:
name: example-user-policy
user: ${example.name}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- ecr:GetAuthorizationToken
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
Resource: '*'
examplePullTimeUpdateExclusion:
type: aws:ecr:PullTimeUpdateExclusion
name: example
properties:
principalArn: ${example.arn}
Create PullTimeUpdateExclusion Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PullTimeUpdateExclusion(name: string, args: PullTimeUpdateExclusionArgs, opts?: CustomResourceOptions);@overload
def PullTimeUpdateExclusion(resource_name: str,
args: PullTimeUpdateExclusionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PullTimeUpdateExclusion(resource_name: str,
opts: Optional[ResourceOptions] = None,
principal_arn: Optional[str] = None,
region: Optional[str] = None)func NewPullTimeUpdateExclusion(ctx *Context, name string, args PullTimeUpdateExclusionArgs, opts ...ResourceOption) (*PullTimeUpdateExclusion, error)public PullTimeUpdateExclusion(string name, PullTimeUpdateExclusionArgs args, CustomResourceOptions? opts = null)
public PullTimeUpdateExclusion(String name, PullTimeUpdateExclusionArgs args)
public PullTimeUpdateExclusion(String name, PullTimeUpdateExclusionArgs args, CustomResourceOptions options)
type: aws:ecr:PullTimeUpdateExclusion
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 PullTimeUpdateExclusionArgs
- 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 PullTimeUpdateExclusionArgs
- 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 PullTimeUpdateExclusionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PullTimeUpdateExclusionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PullTimeUpdateExclusionArgs
- 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 pullTimeUpdateExclusionResource = new Aws.Ecr.PullTimeUpdateExclusion("pullTimeUpdateExclusionResource", new()
{
PrincipalArn = "string",
Region = "string",
});
example, err := ecr.NewPullTimeUpdateExclusion(ctx, "pullTimeUpdateExclusionResource", &ecr.PullTimeUpdateExclusionArgs{
PrincipalArn: pulumi.String("string"),
Region: pulumi.String("string"),
})
var pullTimeUpdateExclusionResource = new PullTimeUpdateExclusion("pullTimeUpdateExclusionResource", PullTimeUpdateExclusionArgs.builder()
.principalArn("string")
.region("string")
.build());
pull_time_update_exclusion_resource = aws.ecr.PullTimeUpdateExclusion("pullTimeUpdateExclusionResource",
principal_arn="string",
region="string")
const pullTimeUpdateExclusionResource = new aws.ecr.PullTimeUpdateExclusion("pullTimeUpdateExclusionResource", {
principalArn: "string",
region: "string",
});
type: aws:ecr:PullTimeUpdateExclusion
properties:
principalArn: string
region: string
PullTimeUpdateExclusion 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 PullTimeUpdateExclusion resource accepts the following input properties:
- Principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn String ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal_
arn str ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn String ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Outputs
All input properties are implicitly available as output properties. Additionally, the PullTimeUpdateExclusion 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 PullTimeUpdateExclusion Resource
Get an existing PullTimeUpdateExclusion 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?: PullTimeUpdateExclusionState, opts?: CustomResourceOptions): PullTimeUpdateExclusion@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
principal_arn: Optional[str] = None,
region: Optional[str] = None) -> PullTimeUpdateExclusionfunc GetPullTimeUpdateExclusion(ctx *Context, name string, id IDInput, state *PullTimeUpdateExclusionState, opts ...ResourceOption) (*PullTimeUpdateExclusion, error)public static PullTimeUpdateExclusion Get(string name, Input<string> id, PullTimeUpdateExclusionState? state, CustomResourceOptions? opts = null)public static PullTimeUpdateExclusion get(String name, Output<String> id, PullTimeUpdateExclusionState state, CustomResourceOptions options)resources: _: type: aws:ecr:PullTimeUpdateExclusion 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.
- Principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn String ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn string ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal_
arn str ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- principal
Arn String ARN of the IAM principal to exclude from having image pull times recorded.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Import
Using pulumi import, import ECR (Elastic Container Registry) Pull Time Update Exclusion using the principal_arn. For example:
$ pulumi import aws:ecr/pullTimeUpdateExclusion:PullTimeUpdateExclusion example arn:aws:iam::123456789012:role/example-role
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
