1. Packages
  2. Time
  3. API Docs
  4. Static
Time v0.1.0 published on Wednesday, Sep 4, 2024 by pulumiverse

time.Static

Explore with Pulumi AI

time logo
Time v0.1.0 published on Wednesday, Sep 4, 2024 by pulumiverse

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as time from "@pulumiverse/time";
    
    const example = new time.Static("example", {});
    export const currentTime = example.rfc3339;
    
    import pulumi
    import pulumiverse_time as time
    
    example = time.Static("example")
    pulumi.export("currentTime", example.rfc3339)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-time/sdk/go/time"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := time.NewStatic(ctx, "example", nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("currentTime", example.Rfc3339)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Time = Pulumiverse.Time;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Time.Static("example");
    
        return new Dictionary<string, object?>
        {
            ["currentTime"] = example.Rfc3339,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.time.Static;
    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 Static("example");
    
            ctx.export("currentTime", example.rfc3339());
        }
    }
    
    resources:
      example:
        type: time:Static
    outputs:
      currentTime: ${example.rfc3339}
    

    Triggers Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as time from "@pulumiverse/time";
    
    const amiUpdate = new time.Static("amiUpdate", {triggers: {
        ami_id: data.aws_ami.example.id,
    }});
    const server = new aws.ec2.Instance("server", {
        ami: amiUpdate.triggers.apply(triggers => triggers?.amiId),
        tags: {
            AmiUpdateTime: amiUpdate.rfc3339,
        },
    });
    // ... (other aws_instance arguments) ...
    
    import pulumi
    import pulumi_aws as aws
    import pulumiverse_time as time
    
    ami_update = time.Static("amiUpdate", triggers={
        "ami_id": data["aws_ami"]["example"]["id"],
    })
    server = aws.ec2.Instance("server",
        ami=ami_update.triggers["amiId"],
        tags={
            "AmiUpdateTime": ami_update.rfc3339,
        })
    # ... (other aws_instance arguments) ...
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-time/sdk/go/time"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		amiUpdate, err := time.NewStatic(ctx, "amiUpdate", &time.StaticArgs{
    			Triggers: pulumi.StringMap{
    				"ami_id": pulumi.Any(data.Aws_ami.Example.Id),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewInstance(ctx, "server", &ec2.InstanceArgs{
    			Ami: pulumi.String(amiUpdate.Triggers.ApplyT(func(triggers map[string]string) (*string, error) {
    				return &triggers.AmiId, nil
    			}).(pulumi.StringPtrOutput)),
    			Tags: pulumi.StringMap{
    				"AmiUpdateTime": amiUpdate.Rfc3339,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Time = Pulumiverse.Time;
    
    return await Deployment.RunAsync(() => 
    {
        var amiUpdate = new Time.Static("amiUpdate", new()
        {
            Triggers = 
            {
                { "ami_id", data.Aws_ami.Example.Id },
            },
        });
    
        var server = new Aws.Ec2.Instance("server", new()
        {
            Ami = amiUpdate.Triggers.Apply(triggers => triggers?.AmiId),
            Tags = 
            {
                { "AmiUpdateTime", amiUpdate.Rfc3339 },
            },
        });
    
        // ... (other aws_instance arguments) ...
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.time.Static;
    import com.pulumi.time.StaticArgs;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    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 amiUpdate = new Static("amiUpdate", StaticArgs.builder()
                .triggers(Map.of("ami_id", data.aws_ami().example().id()))
                .build());
    
            var server = new Instance("server", InstanceArgs.builder()
                .ami(amiUpdate.triggers().applyValue(triggers -> triggers.amiId()))
                .tags(Map.of("AmiUpdateTime", amiUpdate.rfc3339()))
                .build());
    
            // ... (other aws_instance arguments) ...
        }
    }
    
    resources:
      amiUpdate:
        type: time:Static
        properties:
          triggers:
            ami_id: ${data.aws_ami.example.id}
      server:
        type: aws:ec2:Instance
        properties:
          # Read the AMI id "through" the time_static resource to ensure that
          #   # both will change together.
          ami: ${amiUpdate.triggers.amiId}
          tags:
            AmiUpdateTime: ${amiUpdate.rfc3339}
    

    Create Static Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Static(name: string, args?: StaticArgs, opts?: CustomResourceOptions);
    @overload
    def Static(resource_name: str,
               args: Optional[StaticArgs] = None,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Static(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               rfc3339: Optional[str] = None,
               triggers: Optional[Mapping[str, str]] = None)
    func NewStatic(ctx *Context, name string, args *StaticArgs, opts ...ResourceOption) (*Static, error)
    public Static(string name, StaticArgs? args = null, CustomResourceOptions? opts = null)
    public Static(String name, StaticArgs args)
    public Static(String name, StaticArgs args, CustomResourceOptions options)
    
    type: time:Static
    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 StaticArgs
    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 StaticArgs
    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 StaticArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args StaticArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args StaticArgs
    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 staticResource = new Time.Static("staticResource", new()
    {
        Rfc3339 = "string",
        Triggers = 
        {
            { "string", "string" },
        },
    });
    
    example, err := time.NewStatic(ctx, "staticResource", &time.StaticArgs{
    	Rfc3339: pulumi.String("string"),
    	Triggers: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var staticResource = new Static("staticResource", StaticArgs.builder()
        .rfc3339("string")
        .triggers(Map.of("string", "string"))
        .build());
    
    static_resource = time.Static("staticResource",
        rfc3339="string",
        triggers={
            "string": "string",
        })
    
    const staticResource = new time.Static("staticResource", {
        rfc3339: "string",
        triggers: {
            string: "string",
        },
    });
    
    type: time:Static
    properties:
        rfc3339: string
        triggers:
            string: string
    

    Static 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 Static resource accepts the following input properties:

    Rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    Triggers Dictionary<string, string>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    Rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    Triggers map[string]string
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    rfc3339 String
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    triggers Map<String,String>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    triggers {[key: string]: string}
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    rfc3339 str
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    triggers Mapping[str, str]
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    rfc3339 String
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    triggers Map<String>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Static resource produces the following output properties:

    Day int
    Number day of timestamp.
    Hour int
    Number hour of timestamp.
    Id string
    The provider-assigned unique ID for this managed resource.
    Minute int
    Number minute of timestamp.
    Month int
    Number month of timestamp.
    Second int
    Number second of timestamp.
    Unix int
    Number of seconds since epoch time, e.g. 1581489373.
    Year int
    Number year of timestamp.
    Day int
    Number day of timestamp.
    Hour int
    Number hour of timestamp.
    Id string
    The provider-assigned unique ID for this managed resource.
    Minute int
    Number minute of timestamp.
    Month int
    Number month of timestamp.
    Second int
    Number second of timestamp.
    Unix int
    Number of seconds since epoch time, e.g. 1581489373.
    Year int
    Number year of timestamp.
    day Integer
    Number day of timestamp.
    hour Integer
    Number hour of timestamp.
    id String
    The provider-assigned unique ID for this managed resource.
    minute Integer
    Number minute of timestamp.
    month Integer
    Number month of timestamp.
    second Integer
    Number second of timestamp.
    unix Integer
    Number of seconds since epoch time, e.g. 1581489373.
    year Integer
    Number year of timestamp.
    day number
    Number day of timestamp.
    hour number
    Number hour of timestamp.
    id string
    The provider-assigned unique ID for this managed resource.
    minute number
    Number minute of timestamp.
    month number
    Number month of timestamp.
    second number
    Number second of timestamp.
    unix number
    Number of seconds since epoch time, e.g. 1581489373.
    year number
    Number year of timestamp.
    day int
    Number day of timestamp.
    hour int
    Number hour of timestamp.
    id str
    The provider-assigned unique ID for this managed resource.
    minute int
    Number minute of timestamp.
    month int
    Number month of timestamp.
    second int
    Number second of timestamp.
    unix int
    Number of seconds since epoch time, e.g. 1581489373.
    year int
    Number year of timestamp.
    day Number
    Number day of timestamp.
    hour Number
    Number hour of timestamp.
    id String
    The provider-assigned unique ID for this managed resource.
    minute Number
    Number minute of timestamp.
    month Number
    Number month of timestamp.
    second Number
    Number second of timestamp.
    unix Number
    Number of seconds since epoch time, e.g. 1581489373.
    year Number
    Number year of timestamp.

    Look up Existing Static Resource

    Get an existing Static 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?: StaticState, opts?: CustomResourceOptions): Static
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            day: Optional[int] = None,
            hour: Optional[int] = None,
            minute: Optional[int] = None,
            month: Optional[int] = None,
            rfc3339: Optional[str] = None,
            second: Optional[int] = None,
            triggers: Optional[Mapping[str, str]] = None,
            unix: Optional[int] = None,
            year: Optional[int] = None) -> Static
    func GetStatic(ctx *Context, name string, id IDInput, state *StaticState, opts ...ResourceOption) (*Static, error)
    public static Static Get(string name, Input<string> id, StaticState? state, CustomResourceOptions? opts = null)
    public static Static get(String name, Output<String> id, StaticState 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.
    The following state arguments are supported:
    Day int
    Number day of timestamp.
    Hour int
    Number hour of timestamp.
    Minute int
    Number minute of timestamp.
    Month int
    Number month of timestamp.
    Rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    Second int
    Number second of timestamp.
    Triggers Dictionary<string, string>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    Unix int
    Number of seconds since epoch time, e.g. 1581489373.
    Year int
    Number year of timestamp.
    Day int
    Number day of timestamp.
    Hour int
    Number hour of timestamp.
    Minute int
    Number minute of timestamp.
    Month int
    Number month of timestamp.
    Rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    Second int
    Number second of timestamp.
    Triggers map[string]string
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    Unix int
    Number of seconds since epoch time, e.g. 1581489373.
    Year int
    Number year of timestamp.
    day Integer
    Number day of timestamp.
    hour Integer
    Number hour of timestamp.
    minute Integer
    Number minute of timestamp.
    month Integer
    Number month of timestamp.
    rfc3339 String
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    second Integer
    Number second of timestamp.
    triggers Map<String,String>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    unix Integer
    Number of seconds since epoch time, e.g. 1581489373.
    year Integer
    Number year of timestamp.
    day number
    Number day of timestamp.
    hour number
    Number hour of timestamp.
    minute number
    Number minute of timestamp.
    month number
    Number month of timestamp.
    rfc3339 string
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    second number
    Number second of timestamp.
    triggers {[key: string]: string}
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    unix number
    Number of seconds since epoch time, e.g. 1581489373.
    year number
    Number year of timestamp.
    day int
    Number day of timestamp.
    hour int
    Number hour of timestamp.
    minute int
    Number minute of timestamp.
    month int
    Number month of timestamp.
    rfc3339 str
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    second int
    Number second of timestamp.
    triggers Mapping[str, str]
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    unix int
    Number of seconds since epoch time, e.g. 1581489373.
    year int
    Number year of timestamp.
    day Number
    Number day of timestamp.
    hour Number
    Number hour of timestamp.
    minute Number
    Number minute of timestamp.
    month Number
    Number month of timestamp.
    rfc3339 String
    Base timestamp in RFC3339 format (see RFC3339 time string e.g., YYYY-MM-DDTHH:MM:SSZ). Defaults to the current time.
    second Number
    Number second of timestamp.
    triggers Map<String>
    Arbitrary map of values that, when changed, will trigger a new base timestamp value to be saved. See the main provider documentation for more information.
    unix Number
    Number of seconds since epoch time, e.g. 1581489373.
    year Number
    Number year of timestamp.

    Import

    This resource can be imported using the UTC RFC3339 value, e.g.

    $ pulumi import time:index/static:Static example 2020-02-12T06:36:13Z
    

    The triggers argument cannot be imported.

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    time pulumiverse/pulumi-time
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the time Terraform Provider.
    time logo
    Time v0.1.0 published on Wednesday, Sep 4, 2024 by pulumiverse