<gh_stars>0// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Kops
{
    /// <summary>
    /// ## # kops.ClusterUpdater
    /// 
    /// This resource applies the cluster state on the target cloud provider and performs a rolling update.
    /// 
    /// The rolling update and cluster validation can be disabled and/or configured through resource attributes.
    /// 
    /// &gt; This resource will trigger based on the `keepers` map attribute.
    /// Thats is, if something changes in the attribute, the resource update handler will fire and an apply/rolling update/validate cycle will run.
    /// A good candidate for `keepers` is to use the `revision` coming from `kops.Cluster` and `kops.InstanceGroup` resources.
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Kops = Pulumi.Kops;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var cluster = new Kops.Cluster("cluster");
    /// 
    ///     // ....
    ///     var master_0 = new Kops.InstanceGroup("master-0", new()
    ///     {
    ///         ClusterName = cluster.Name,
    ///         Role = "Master",
    ///         MinSize = 1,
    ///         MaxSize = 1,
    ///         MachineType = "t3.medium",
    ///         Subnets = new[]
    ///         {
    ///             "private-0",
    ///         },
    ///     }, new CustomResourceOptions
    ///     {
    ///         DependsOn = new[]
    ///         {
    ///             cluster,
    ///         },
    ///     });
    /// 
    ///     var master_1 = new Kops.InstanceGroup("master-1", new()
    ///     {
    ///         ClusterName = cluster.Name,
    ///         Role = "Master",
    ///         MinSize = 1,
    ///         MaxSize = 1,
    ///         MachineType = "t3.medium",
    ///         Subnets = new[]
    ///         {
    ///             "private-1",
    ///         },
    ///     }, new CustomResourceOptions
    ///     {
    ///         DependsOn = new[]
    ///         {
    ///             cluster,
    ///         },
    ///     });
    /// 
    ///     var master_2 = new Kops.InstanceGroup("master-2", new()
    ///     {
    ///         ClusterName = cluster.Name,
    ///         Role = "Master",
    ///         MinSize = 1,
    ///         MaxSize = 1,
    ///         MachineType = "t3.medium",
    ///         Subnets = new[]
    ///         {
    ///             "private-2",
    ///         },
    ///     }, new CustomResourceOptions
    ///     {
    ///         DependsOn = new[]
    ///         {
    ///             cluster,
    ///         },
    ///     });
    /// 
    ///     var updater = new Kops.ClusterUpdater("updater", new()
    ///     {
    ///         ClusterName = cluster.Name,
    ///         Keepers = 
    ///         {
    ///             { "cluster", cluster.Revision },
    ///             { "master-0", master_0.Revision },
    ///             { "master-1", master_1.Revision },
    ///             { "master-2", master_2.Revision },
    ///         },
    ///         RollingUpdate = new Kops.Inputs.ClusterUpdaterRollingUpdateArgs
    ///         {
    ///             Skip = false,
    ///             FailOnDrainError = true,
    ///             FailOnValidate = true,
    ///             ValidateCount = 1,
    ///         },
    ///         Validate = new Kops.Inputs.ClusterUpdaterValidateArgs
    ///         {
    ///             Skip = false,
    ///         },
    ///     }, new CustomResourceOptions
    ///     {
    ///         DependsOn = new[]
    ///         {
    ///             cluster,
    ///             master_0,
    ///             master_1,
    ///             master_2,
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// ## Nested resources
    /// 
    /// ### apply_options
    /// 
    /// #### Argument Reference
    /// 
    /// The following arguments are supported:
    /// 
    /// - `skip` - (Optional) - Bool - Skip allows skipping cluster apply.
    /// - `allow_kops_downgrade` - (Optional) - Bool - AllowKopsDowngrade permits applying with a kops version older than what was last used to apply to the cluster.
    /// - `lifecycle_overrides` - (Optional) - Map(String) - LifecycleOverrides is passed in to override the lifecycle for one of more tasks.&lt;br /&gt;The key value is the task name such as InternetGateway and the value is the fi.Lifecycle&lt;br /&gt;that is re-mapped.
    /// 
    /// ### rolling_update_options
    /// 
    /// #### Argument Reference
    /// 
    /// The following arguments are supported:
    /// 
    /// - `skip` - (Optional) - Bool - Skip allows skipping cluster rolling update.
    /// - `master_interval` - (Optional) - Duration - MasterInterval is the amount of time to wait after stopping a master instance.
    /// - `node_interval` - (Optional) - Duration - NodeInterval is the amount of time to wait after stopping a non-master instance.
    /// - `bastion_interval` - (Optional) - Duration - BastionInterval is the amount of time to wait after stopping a bastion instance.
    /// - `fail_on_drain_error` - (Optional) - Bool - FailOnDrainError will fail when a drain error occurs.
    /// - `fail_on_validate` - (Optional) - Bool - FailOnValidate will fail when a validation error occurs.
    /// - `post_drain_delay` - (Optional) - Duration - PostDrainDelay is the duration we wait after draining each node.
    /// - `validation_timeout` - (Optional) - Duration - ValidationTimeout is the maximum time to wait for the cluster to validate, once we start validation.
    /// - `validate_count` - (Optional) - Int - ValidateCount is the amount of time that a cluster needs to be validated after single node update.
    /// - `cloud_only` - (Optional) - Bool - CloudOnly perform rolling update without confirming progress with k8s.
    /// - `force` - (Optional) - Bool - Force forces a rolling update.
    /// 
    /// ### validate_options
    /// 
    /// #### Argument Reference
    /// 
    /// The following arguments are supported:
    /// 
    /// - `skip` - (Optional) - Bool - Skip allows skipping cluster validation.
    /// - `timeout` - (Optional) - Duration - Timeout defines the maximum time to wait until the cluster becomes valid.
    /// - `poll_interval` - (Optional) - Duration - PollInterval defines the interval between validation attempts.
    /// </summary>
    [KopsResourceType("kops:index/clusterUpdater:ClusterUpdater")]
    public partial class ClusterUpdater : global::Pulumi.CustomResource
    {
        /// <summary>
        /// - apply_options - Apply holds cluster apply options.
        /// </summary>
        [Output("apply")]
        public Output<Outputs.ClusterUpdaterApply?> Apply { get; private set; } = null!;

        /// <summary>
        /// - String - ClusterName is the target cluster name.
        /// </summary>
        [Output("clusterName")]
        public Output<string> ClusterName { get; private set; } = null!;

        /// <summary>
        /// - Map(String) - Keepers contains arbitrary strings used to update the resource when one changes.
        /// </summary>
        [Output("keepers")]
        public Output<ImmutableDictionary<string, string>?> Keepers { get; private set; } = null!;

        /// <summary>
        /// - String - ProviderVersion is set to the currently running provider version, this will trigger cluster updater on version changes.
        /// </summary>
        [Output("providerVersion")]
        public Output<string> ProviderVersion { get; private set; } = null!;

        /// <summary>
        /// - Int - Revision is incremented every time the resource changes, this is useful for triggering cluster updater.
        /// </summary>
        [Output("revision")]
        public Output<int> Revision { get; private set; } = null!;

        /// <summary>
        /// - rolling_update_options - RollingUpdate holds cluster rolling update options.
        /// </summary>
        [Output("rollingUpdate")]
        public Output<Outputs.ClusterUpdaterRollingUpdate?> RollingUpdate { get; private set; } = null!;

        /// <summary>
        /// - validate_options - Validate holds cluster validation options.
        /// </summary>
        [Output("validate")]
        public Output<Outputs.ClusterUpdaterValidate?> Validate { get; private set; } = null!;


        /// <summary>
        /// Create a ClusterUpdater resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public ClusterUpdater(string name, ClusterUpdaterArgs args, CustomResourceOptions? options = null)
            : base("kops:index/clusterUpdater:ClusterUpdater", name, args ?? new ClusterUpdaterArgs(), MakeResourceOptions(options, ""))
        {
        }

        private ClusterUpdater(string name, Input<string> id, ClusterUpdaterState? state = null, CustomResourceOptions? options = null)
            : base("kops:index/clusterUpdater:ClusterUpdater", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing ClusterUpdater resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static ClusterUpdater Get(string name, Input<string> id, ClusterUpdaterState? state = null, CustomResourceOptions? options = null)
        {
            return new ClusterUpdater(name, id, state, options);
        }
    }

    public sealed class ClusterUpdaterArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// - apply_options - Apply holds cluster apply options.
        /// </summary>
        [Input("apply")]
        public Input<Inputs.ClusterUpdaterApplyArgs>? Apply { get; set; }

        /// <summary>
        /// - String - ClusterName is the target cluster name.
        /// </summary>
        [Input("clusterName", required: true)]
        public Input<string> ClusterName { get; set; } = null!;

        [Input("keepers")]
        private InputMap<string>? _keepers;

        /// <summary>
        /// - Map(String) - Keepers contains arbitrary strings used to update the resource when one changes.
        /// </summary>
        public InputMap<string> Keepers
        {
            get => _keepers ?? (_keepers = new InputMap<string>());
            set => _keepers = value;
        }

        /// <summary>
        /// - rolling_update_options - RollingUpdate holds cluster rolling update options.
        /// </summary>
        [Input("rollingUpdate")]
        public Input<Inputs.ClusterUpdaterRollingUpdateArgs>? RollingUpdate { get; set; }

        /// <summary>
        /// - validate_options - Validate holds cluster validation options.
        /// </summary>
        [Input("validate")]
        public Input<Inputs.ClusterUpdaterValidateArgs>? Validate { get; set; }

        public ClusterUpdaterArgs()
        {
        }
        public static new ClusterUpdaterArgs Empty => new ClusterUpdaterArgs();
    }

    public sealed class ClusterUpdaterState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// - apply_options - Apply holds cluster apply options.
        /// </summary>
        [Input("apply")]
        public Input<Inputs.ClusterUpdaterApplyGetArgs>? Apply { get; set; }

        /// <summary>
        /// - String - ClusterName is the target cluster name.
        /// </summary>
        [Input("clusterName")]
        public Input<string>? ClusterName { get; set; }

        [Input("keepers")]
        private InputMap<string>? _keepers;

        /// <summary>
        /// - Map(String) - Keepers contains arbitrary strings used to update the resource when one changes.
        /// </summary>
        public InputMap<string> Keepers
        {
            get => _keepers ?? (_keepers = new InputMap<string>());
            set => _keepers = value;
        }

        /// <summary>
        /// - String - ProviderVersion is set to the currently running provider version, this will trigger cluster updater on version changes.
        /// </summary>
        [Input("providerVersion")]
        public Input<string>? ProviderVersion { get; set; }

        /// <summary>
        /// - Int - Revision is incremented every time the resource changes, this is useful for triggering cluster updater.
        /// </summary>
        [Input("revision")]
        public Input<int>? Revision { get; set; }

        /// <summary>
        /// - rolling_update_options - RollingUpdate holds cluster rolling update options.
        /// </summary>
        [Input("rollingUpdate")]
        public Input<Inputs.ClusterUpdaterRollingUpdateGetArgs>? RollingUpdate { get; set; }

        /// <summary>
        /// - validate_options - Validate holds cluster validation options.
        /// </summary>
        [Input("validate")]
        public Input<Inputs.ClusterUpdaterValidateGetArgs>? Validate { get; set; }

        public ClusterUpdaterState()
        {
        }
        public static new ClusterUpdaterState Empty => new ClusterUpdaterState();
    }
}
