github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appconfig/environment.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package appconfig
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides an AppConfig Environment resource for an `appconfig.Application` resource. One or more environments can be defined for an application.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appconfig"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			exampleApplication, err := appconfig.NewApplication(ctx, "example", &appconfig.ApplicationArgs{
    33  //				Name:        pulumi.String("example-application-tf"),
    34  //				Description: pulumi.String("Example AppConfig Application"),
    35  //				Tags: pulumi.StringMap{
    36  //					"Type": pulumi.String("AppConfig Application"),
    37  //				},
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			_, err = appconfig.NewEnvironment(ctx, "example", &appconfig.EnvironmentArgs{
    43  //				Name:          pulumi.String("example-environment-tf"),
    44  //				Description:   pulumi.String("Example AppConfig Environment"),
    45  //				ApplicationId: exampleApplication.ID(),
    46  //				Monitors: appconfig.EnvironmentMonitorArray{
    47  //					&appconfig.EnvironmentMonitorArgs{
    48  //						AlarmArn:     pulumi.Any(exampleAwsCloudwatchMetricAlarm.Arn),
    49  //						AlarmRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
    50  //					},
    51  //				},
    52  //				Tags: pulumi.StringMap{
    53  //					"Type": pulumi.String("AppConfig Environment"),
    54  //				},
    55  //			})
    56  //			if err != nil {
    57  //				return err
    58  //			}
    59  //			return nil
    60  //		})
    61  //	}
    62  //
    63  // ```
    64  // <!--End PulumiCodeChooser -->
    65  //
    66  // ## Import
    67  //
    68  // Using `pulumi import`, import AppConfig Environments using the environment ID and application ID separated by a colon (`:`). For example:
    69  //
    70  // ```sh
    71  // $ pulumi import aws:appconfig/environment:Environment example 71abcde:11xxxxx
    72  // ```
    73  type Environment struct {
    74  	pulumi.CustomResourceState
    75  
    76  	// AppConfig application ID. Must be between 4 and 7 characters in length.
    77  	ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
    78  	// ARN of the AppConfig Environment.
    79  	Arn pulumi.StringOutput `pulumi:"arn"`
    80  	// Description of the environment. Can be at most 1024 characters.
    81  	Description pulumi.StringOutput `pulumi:"description"`
    82  	// AppConfig environment ID.
    83  	EnvironmentId pulumi.StringOutput `pulumi:"environmentId"`
    84  	// Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
    85  	Monitors EnvironmentMonitorArrayOutput `pulumi:"monitors"`
    86  	// Name for the environment. Must be between 1 and 64 characters in length.
    87  	Name pulumi.StringOutput `pulumi:"name"`
    88  	// State of the environment. Possible values are `READY_FOR_DEPLOYMENT`, `DEPLOYING`, `ROLLING_BACK`
    89  	// or `ROLLED_BACK`.
    90  	State pulumi.StringOutput `pulumi:"state"`
    91  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    92  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    93  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    94  	//
    95  	// Deprecated: Please use `tags` instead.
    96  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    97  }
    98  
    99  // NewEnvironment registers a new resource with the given unique name, arguments, and options.
   100  func NewEnvironment(ctx *pulumi.Context,
   101  	name string, args *EnvironmentArgs, opts ...pulumi.ResourceOption) (*Environment, error) {
   102  	if args == nil {
   103  		return nil, errors.New("missing one or more required arguments")
   104  	}
   105  
   106  	if args.ApplicationId == nil {
   107  		return nil, errors.New("invalid value for required argument 'ApplicationId'")
   108  	}
   109  	opts = internal.PkgResourceDefaultOpts(opts)
   110  	var resource Environment
   111  	err := ctx.RegisterResource("aws:appconfig/environment:Environment", name, args, &resource, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return &resource, nil
   116  }
   117  
   118  // GetEnvironment gets an existing Environment resource's state with the given name, ID, and optional
   119  // state properties that are used to uniquely qualify the lookup (nil if not required).
   120  func GetEnvironment(ctx *pulumi.Context,
   121  	name string, id pulumi.IDInput, state *EnvironmentState, opts ...pulumi.ResourceOption) (*Environment, error) {
   122  	var resource Environment
   123  	err := ctx.ReadResource("aws:appconfig/environment:Environment", name, id, state, &resource, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return &resource, nil
   128  }
   129  
   130  // Input properties used for looking up and filtering Environment resources.
   131  type environmentState struct {
   132  	// AppConfig application ID. Must be between 4 and 7 characters in length.
   133  	ApplicationId *string `pulumi:"applicationId"`
   134  	// ARN of the AppConfig Environment.
   135  	Arn *string `pulumi:"arn"`
   136  	// Description of the environment. Can be at most 1024 characters.
   137  	Description *string `pulumi:"description"`
   138  	// AppConfig environment ID.
   139  	EnvironmentId *string `pulumi:"environmentId"`
   140  	// Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
   141  	Monitors []EnvironmentMonitor `pulumi:"monitors"`
   142  	// Name for the environment. Must be between 1 and 64 characters in length.
   143  	Name *string `pulumi:"name"`
   144  	// State of the environment. Possible values are `READY_FOR_DEPLOYMENT`, `DEPLOYING`, `ROLLING_BACK`
   145  	// or `ROLLED_BACK`.
   146  	State *string `pulumi:"state"`
   147  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   148  	Tags map[string]string `pulumi:"tags"`
   149  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   150  	//
   151  	// Deprecated: Please use `tags` instead.
   152  	TagsAll map[string]string `pulumi:"tagsAll"`
   153  }
   154  
   155  type EnvironmentState struct {
   156  	// AppConfig application ID. Must be between 4 and 7 characters in length.
   157  	ApplicationId pulumi.StringPtrInput
   158  	// ARN of the AppConfig Environment.
   159  	Arn pulumi.StringPtrInput
   160  	// Description of the environment. Can be at most 1024 characters.
   161  	Description pulumi.StringPtrInput
   162  	// AppConfig environment ID.
   163  	EnvironmentId pulumi.StringPtrInput
   164  	// Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
   165  	Monitors EnvironmentMonitorArrayInput
   166  	// Name for the environment. Must be between 1 and 64 characters in length.
   167  	Name pulumi.StringPtrInput
   168  	// State of the environment. Possible values are `READY_FOR_DEPLOYMENT`, `DEPLOYING`, `ROLLING_BACK`
   169  	// or `ROLLED_BACK`.
   170  	State pulumi.StringPtrInput
   171  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   172  	Tags pulumi.StringMapInput
   173  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   174  	//
   175  	// Deprecated: Please use `tags` instead.
   176  	TagsAll pulumi.StringMapInput
   177  }
   178  
   179  func (EnvironmentState) ElementType() reflect.Type {
   180  	return reflect.TypeOf((*environmentState)(nil)).Elem()
   181  }
   182  
   183  type environmentArgs struct {
   184  	// AppConfig application ID. Must be between 4 and 7 characters in length.
   185  	ApplicationId string `pulumi:"applicationId"`
   186  	// Description of the environment. Can be at most 1024 characters.
   187  	Description *string `pulumi:"description"`
   188  	// Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
   189  	Monitors []EnvironmentMonitor `pulumi:"monitors"`
   190  	// Name for the environment. Must be between 1 and 64 characters in length.
   191  	Name *string `pulumi:"name"`
   192  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   193  	Tags map[string]string `pulumi:"tags"`
   194  }
   195  
   196  // The set of arguments for constructing a Environment resource.
   197  type EnvironmentArgs struct {
   198  	// AppConfig application ID. Must be between 4 and 7 characters in length.
   199  	ApplicationId pulumi.StringInput
   200  	// Description of the environment. Can be at most 1024 characters.
   201  	Description pulumi.StringPtrInput
   202  	// Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
   203  	Monitors EnvironmentMonitorArrayInput
   204  	// Name for the environment. Must be between 1 and 64 characters in length.
   205  	Name pulumi.StringPtrInput
   206  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   207  	Tags pulumi.StringMapInput
   208  }
   209  
   210  func (EnvironmentArgs) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*environmentArgs)(nil)).Elem()
   212  }
   213  
   214  type EnvironmentInput interface {
   215  	pulumi.Input
   216  
   217  	ToEnvironmentOutput() EnvironmentOutput
   218  	ToEnvironmentOutputWithContext(ctx context.Context) EnvironmentOutput
   219  }
   220  
   221  func (*Environment) ElementType() reflect.Type {
   222  	return reflect.TypeOf((**Environment)(nil)).Elem()
   223  }
   224  
   225  func (i *Environment) ToEnvironmentOutput() EnvironmentOutput {
   226  	return i.ToEnvironmentOutputWithContext(context.Background())
   227  }
   228  
   229  func (i *Environment) ToEnvironmentOutputWithContext(ctx context.Context) EnvironmentOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(EnvironmentOutput)
   231  }
   232  
   233  // EnvironmentArrayInput is an input type that accepts EnvironmentArray and EnvironmentArrayOutput values.
   234  // You can construct a concrete instance of `EnvironmentArrayInput` via:
   235  //
   236  //	EnvironmentArray{ EnvironmentArgs{...} }
   237  type EnvironmentArrayInput interface {
   238  	pulumi.Input
   239  
   240  	ToEnvironmentArrayOutput() EnvironmentArrayOutput
   241  	ToEnvironmentArrayOutputWithContext(context.Context) EnvironmentArrayOutput
   242  }
   243  
   244  type EnvironmentArray []EnvironmentInput
   245  
   246  func (EnvironmentArray) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*[]*Environment)(nil)).Elem()
   248  }
   249  
   250  func (i EnvironmentArray) ToEnvironmentArrayOutput() EnvironmentArrayOutput {
   251  	return i.ToEnvironmentArrayOutputWithContext(context.Background())
   252  }
   253  
   254  func (i EnvironmentArray) ToEnvironmentArrayOutputWithContext(ctx context.Context) EnvironmentArrayOutput {
   255  	return pulumi.ToOutputWithContext(ctx, i).(EnvironmentArrayOutput)
   256  }
   257  
   258  // EnvironmentMapInput is an input type that accepts EnvironmentMap and EnvironmentMapOutput values.
   259  // You can construct a concrete instance of `EnvironmentMapInput` via:
   260  //
   261  //	EnvironmentMap{ "key": EnvironmentArgs{...} }
   262  type EnvironmentMapInput interface {
   263  	pulumi.Input
   264  
   265  	ToEnvironmentMapOutput() EnvironmentMapOutput
   266  	ToEnvironmentMapOutputWithContext(context.Context) EnvironmentMapOutput
   267  }
   268  
   269  type EnvironmentMap map[string]EnvironmentInput
   270  
   271  func (EnvironmentMap) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*map[string]*Environment)(nil)).Elem()
   273  }
   274  
   275  func (i EnvironmentMap) ToEnvironmentMapOutput() EnvironmentMapOutput {
   276  	return i.ToEnvironmentMapOutputWithContext(context.Background())
   277  }
   278  
   279  func (i EnvironmentMap) ToEnvironmentMapOutputWithContext(ctx context.Context) EnvironmentMapOutput {
   280  	return pulumi.ToOutputWithContext(ctx, i).(EnvironmentMapOutput)
   281  }
   282  
   283  type EnvironmentOutput struct{ *pulumi.OutputState }
   284  
   285  func (EnvironmentOutput) ElementType() reflect.Type {
   286  	return reflect.TypeOf((**Environment)(nil)).Elem()
   287  }
   288  
   289  func (o EnvironmentOutput) ToEnvironmentOutput() EnvironmentOutput {
   290  	return o
   291  }
   292  
   293  func (o EnvironmentOutput) ToEnvironmentOutputWithContext(ctx context.Context) EnvironmentOutput {
   294  	return o
   295  }
   296  
   297  // AppConfig application ID. Must be between 4 and 7 characters in length.
   298  func (o EnvironmentOutput) ApplicationId() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
   300  }
   301  
   302  // ARN of the AppConfig Environment.
   303  func (o EnvironmentOutput) Arn() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   305  }
   306  
   307  // Description of the environment. Can be at most 1024 characters.
   308  func (o EnvironmentOutput) Description() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   310  }
   311  
   312  // AppConfig environment ID.
   313  func (o EnvironmentOutput) EnvironmentId() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.EnvironmentId }).(pulumi.StringOutput)
   315  }
   316  
   317  // Set of Amazon CloudWatch alarms to monitor during the deployment process. Maximum of 5. See Monitor below for more details.
   318  func (o EnvironmentOutput) Monitors() EnvironmentMonitorArrayOutput {
   319  	return o.ApplyT(func(v *Environment) EnvironmentMonitorArrayOutput { return v.Monitors }).(EnvironmentMonitorArrayOutput)
   320  }
   321  
   322  // Name for the environment. Must be between 1 and 64 characters in length.
   323  func (o EnvironmentOutput) Name() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   325  }
   326  
   327  // State of the environment. Possible values are `READY_FOR_DEPLOYMENT`, `DEPLOYING`, `ROLLING_BACK`
   328  // or `ROLLED_BACK`.
   329  func (o EnvironmentOutput) State() pulumi.StringOutput {
   330  	return o.ApplyT(func(v *Environment) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
   331  }
   332  
   333  // Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   334  func (o EnvironmentOutput) Tags() pulumi.StringMapOutput {
   335  	return o.ApplyT(func(v *Environment) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   336  }
   337  
   338  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   339  //
   340  // Deprecated: Please use `tags` instead.
   341  func (o EnvironmentOutput) TagsAll() pulumi.StringMapOutput {
   342  	return o.ApplyT(func(v *Environment) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   343  }
   344  
   345  type EnvironmentArrayOutput struct{ *pulumi.OutputState }
   346  
   347  func (EnvironmentArrayOutput) ElementType() reflect.Type {
   348  	return reflect.TypeOf((*[]*Environment)(nil)).Elem()
   349  }
   350  
   351  func (o EnvironmentArrayOutput) ToEnvironmentArrayOutput() EnvironmentArrayOutput {
   352  	return o
   353  }
   354  
   355  func (o EnvironmentArrayOutput) ToEnvironmentArrayOutputWithContext(ctx context.Context) EnvironmentArrayOutput {
   356  	return o
   357  }
   358  
   359  func (o EnvironmentArrayOutput) Index(i pulumi.IntInput) EnvironmentOutput {
   360  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Environment {
   361  		return vs[0].([]*Environment)[vs[1].(int)]
   362  	}).(EnvironmentOutput)
   363  }
   364  
   365  type EnvironmentMapOutput struct{ *pulumi.OutputState }
   366  
   367  func (EnvironmentMapOutput) ElementType() reflect.Type {
   368  	return reflect.TypeOf((*map[string]*Environment)(nil)).Elem()
   369  }
   370  
   371  func (o EnvironmentMapOutput) ToEnvironmentMapOutput() EnvironmentMapOutput {
   372  	return o
   373  }
   374  
   375  func (o EnvironmentMapOutput) ToEnvironmentMapOutputWithContext(ctx context.Context) EnvironmentMapOutput {
   376  	return o
   377  }
   378  
   379  func (o EnvironmentMapOutput) MapIndex(k pulumi.StringInput) EnvironmentOutput {
   380  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Environment {
   381  		return vs[0].(map[string]*Environment)[vs[1].(string)]
   382  	}).(EnvironmentOutput)
   383  }
   384  
   385  func init() {
   386  	pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentInput)(nil)).Elem(), &Environment{})
   387  	pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentArrayInput)(nil)).Elem(), EnvironmentArray{})
   388  	pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentMapInput)(nil)).Elem(), EnvironmentMap{})
   389  	pulumi.RegisterOutputType(EnvironmentOutput{})
   390  	pulumi.RegisterOutputType(EnvironmentArrayOutput{})
   391  	pulumi.RegisterOutputType(EnvironmentMapOutput{})
   392  }