github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/resolverRule.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 route53
     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 a Route53 Resolver rule.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### System rule
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := route53.NewResolverRule(ctx, "sys", &route53.ResolverRuleArgs{
    35  //				DomainName: pulumi.String("subdomain.example.com"),
    36  //				RuleType:   pulumi.String("SYSTEM"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ### Forward rule
    49  //
    50  // <!--Start PulumiCodeChooser -->
    51  // ```go
    52  // package main
    53  //
    54  // import (
    55  //
    56  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    57  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    58  //
    59  // )
    60  //
    61  //	func main() {
    62  //		pulumi.Run(func(ctx *pulumi.Context) error {
    63  //			_, err := route53.NewResolverRule(ctx, "fwd", &route53.ResolverRuleArgs{
    64  //				DomainName:         pulumi.String("example.com"),
    65  //				Name:               pulumi.String("example"),
    66  //				RuleType:           pulumi.String("FORWARD"),
    67  //				ResolverEndpointId: pulumi.Any(foo.Id),
    68  //				TargetIps: route53.ResolverRuleTargetIpArray{
    69  //					&route53.ResolverRuleTargetIpArgs{
    70  //						Ip: pulumi.String("123.45.67.89"),
    71  //					},
    72  //				},
    73  //				Tags: pulumi.StringMap{
    74  //					"Environment": pulumi.String("Prod"),
    75  //				},
    76  //			})
    77  //			if err != nil {
    78  //				return err
    79  //			}
    80  //			return nil
    81  //		})
    82  //	}
    83  //
    84  // ```
    85  // <!--End PulumiCodeChooser -->
    86  //
    87  // ## Import
    88  //
    89  // Using `pulumi import`, import Route53 Resolver rules using the `id`. For example:
    90  //
    91  // ```sh
    92  // $ pulumi import aws:route53/resolverRule:ResolverRule sys rslvr-rr-0123456789abcdef0
    93  // ```
    94  type ResolverRule struct {
    95  	pulumi.CustomResourceState
    96  
    97  	// The ARN (Amazon Resource Name) for the resolver rule.
    98  	Arn pulumi.StringOutput `pulumi:"arn"`
    99  	// DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   100  	DomainName pulumi.StringOutput `pulumi:"domainName"`
   101  	// A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   102  	Name pulumi.StringOutput `pulumi:"name"`
   103  	// When a rule is shared with another AWS account, the account ID of the account that the rule is shared with.
   104  	OwnerId pulumi.StringOutput `pulumi:"ownerId"`
   105  	// The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   106  	// This argument should only be specified for `FORWARD` type rules.
   107  	ResolverEndpointId pulumi.StringPtrOutput `pulumi:"resolverEndpointId"`
   108  	// The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   109  	RuleType pulumi.StringOutput `pulumi:"ruleType"`
   110  	// Whether the rules is shared and, if so, whether the current account is sharing the rule with another account, or another account is sharing the rule with the current account.
   111  	// Values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   112  	ShareStatus pulumi.StringOutput `pulumi:"shareStatus"`
   113  	// A 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.
   114  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   115  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   116  	//
   117  	// Deprecated: Please use `tags` instead.
   118  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   119  	// Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   120  	// This argument should only be specified for `FORWARD` type rules.
   121  	TargetIps ResolverRuleTargetIpArrayOutput `pulumi:"targetIps"`
   122  }
   123  
   124  // NewResolverRule registers a new resource with the given unique name, arguments, and options.
   125  func NewResolverRule(ctx *pulumi.Context,
   126  	name string, args *ResolverRuleArgs, opts ...pulumi.ResourceOption) (*ResolverRule, error) {
   127  	if args == nil {
   128  		return nil, errors.New("missing one or more required arguments")
   129  	}
   130  
   131  	if args.DomainName == nil {
   132  		return nil, errors.New("invalid value for required argument 'DomainName'")
   133  	}
   134  	if args.RuleType == nil {
   135  		return nil, errors.New("invalid value for required argument 'RuleType'")
   136  	}
   137  	opts = internal.PkgResourceDefaultOpts(opts)
   138  	var resource ResolverRule
   139  	err := ctx.RegisterResource("aws:route53/resolverRule:ResolverRule", name, args, &resource, opts...)
   140  	if err != nil {
   141  		return nil, err
   142  	}
   143  	return &resource, nil
   144  }
   145  
   146  // GetResolverRule gets an existing ResolverRule resource's state with the given name, ID, and optional
   147  // state properties that are used to uniquely qualify the lookup (nil if not required).
   148  func GetResolverRule(ctx *pulumi.Context,
   149  	name string, id pulumi.IDInput, state *ResolverRuleState, opts ...pulumi.ResourceOption) (*ResolverRule, error) {
   150  	var resource ResolverRule
   151  	err := ctx.ReadResource("aws:route53/resolverRule:ResolverRule", name, id, state, &resource, opts...)
   152  	if err != nil {
   153  		return nil, err
   154  	}
   155  	return &resource, nil
   156  }
   157  
   158  // Input properties used for looking up and filtering ResolverRule resources.
   159  type resolverRuleState struct {
   160  	// The ARN (Amazon Resource Name) for the resolver rule.
   161  	Arn *string `pulumi:"arn"`
   162  	// DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   163  	DomainName *string `pulumi:"domainName"`
   164  	// A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   165  	Name *string `pulumi:"name"`
   166  	// When a rule is shared with another AWS account, the account ID of the account that the rule is shared with.
   167  	OwnerId *string `pulumi:"ownerId"`
   168  	// The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   169  	// This argument should only be specified for `FORWARD` type rules.
   170  	ResolverEndpointId *string `pulumi:"resolverEndpointId"`
   171  	// The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   172  	RuleType *string `pulumi:"ruleType"`
   173  	// Whether the rules is shared and, if so, whether the current account is sharing the rule with another account, or another account is sharing the rule with the current account.
   174  	// Values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   175  	ShareStatus *string `pulumi:"shareStatus"`
   176  	// A 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.
   177  	Tags map[string]string `pulumi:"tags"`
   178  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   179  	//
   180  	// Deprecated: Please use `tags` instead.
   181  	TagsAll map[string]string `pulumi:"tagsAll"`
   182  	// Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   183  	// This argument should only be specified for `FORWARD` type rules.
   184  	TargetIps []ResolverRuleTargetIp `pulumi:"targetIps"`
   185  }
   186  
   187  type ResolverRuleState struct {
   188  	// The ARN (Amazon Resource Name) for the resolver rule.
   189  	Arn pulumi.StringPtrInput
   190  	// DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   191  	DomainName pulumi.StringPtrInput
   192  	// A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   193  	Name pulumi.StringPtrInput
   194  	// When a rule is shared with another AWS account, the account ID of the account that the rule is shared with.
   195  	OwnerId pulumi.StringPtrInput
   196  	// The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   197  	// This argument should only be specified for `FORWARD` type rules.
   198  	ResolverEndpointId pulumi.StringPtrInput
   199  	// The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   200  	RuleType pulumi.StringPtrInput
   201  	// Whether the rules is shared and, if so, whether the current account is sharing the rule with another account, or another account is sharing the rule with the current account.
   202  	// Values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   203  	ShareStatus pulumi.StringPtrInput
   204  	// A 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.
   205  	Tags pulumi.StringMapInput
   206  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   207  	//
   208  	// Deprecated: Please use `tags` instead.
   209  	TagsAll pulumi.StringMapInput
   210  	// Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   211  	// This argument should only be specified for `FORWARD` type rules.
   212  	TargetIps ResolverRuleTargetIpArrayInput
   213  }
   214  
   215  func (ResolverRuleState) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*resolverRuleState)(nil)).Elem()
   217  }
   218  
   219  type resolverRuleArgs struct {
   220  	// DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   221  	DomainName string `pulumi:"domainName"`
   222  	// A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   223  	Name *string `pulumi:"name"`
   224  	// The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   225  	// This argument should only be specified for `FORWARD` type rules.
   226  	ResolverEndpointId *string `pulumi:"resolverEndpointId"`
   227  	// The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   228  	RuleType string `pulumi:"ruleType"`
   229  	// A 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.
   230  	Tags map[string]string `pulumi:"tags"`
   231  	// Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   232  	// This argument should only be specified for `FORWARD` type rules.
   233  	TargetIps []ResolverRuleTargetIp `pulumi:"targetIps"`
   234  }
   235  
   236  // The set of arguments for constructing a ResolverRule resource.
   237  type ResolverRuleArgs struct {
   238  	// DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   239  	DomainName pulumi.StringInput
   240  	// A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   241  	Name pulumi.StringPtrInput
   242  	// The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   243  	// This argument should only be specified for `FORWARD` type rules.
   244  	ResolverEndpointId pulumi.StringPtrInput
   245  	// The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   246  	RuleType pulumi.StringInput
   247  	// A 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.
   248  	Tags pulumi.StringMapInput
   249  	// Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   250  	// This argument should only be specified for `FORWARD` type rules.
   251  	TargetIps ResolverRuleTargetIpArrayInput
   252  }
   253  
   254  func (ResolverRuleArgs) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*resolverRuleArgs)(nil)).Elem()
   256  }
   257  
   258  type ResolverRuleInput interface {
   259  	pulumi.Input
   260  
   261  	ToResolverRuleOutput() ResolverRuleOutput
   262  	ToResolverRuleOutputWithContext(ctx context.Context) ResolverRuleOutput
   263  }
   264  
   265  func (*ResolverRule) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**ResolverRule)(nil)).Elem()
   267  }
   268  
   269  func (i *ResolverRule) ToResolverRuleOutput() ResolverRuleOutput {
   270  	return i.ToResolverRuleOutputWithContext(context.Background())
   271  }
   272  
   273  func (i *ResolverRule) ToResolverRuleOutputWithContext(ctx context.Context) ResolverRuleOutput {
   274  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleOutput)
   275  }
   276  
   277  // ResolverRuleArrayInput is an input type that accepts ResolverRuleArray and ResolverRuleArrayOutput values.
   278  // You can construct a concrete instance of `ResolverRuleArrayInput` via:
   279  //
   280  //	ResolverRuleArray{ ResolverRuleArgs{...} }
   281  type ResolverRuleArrayInput interface {
   282  	pulumi.Input
   283  
   284  	ToResolverRuleArrayOutput() ResolverRuleArrayOutput
   285  	ToResolverRuleArrayOutputWithContext(context.Context) ResolverRuleArrayOutput
   286  }
   287  
   288  type ResolverRuleArray []ResolverRuleInput
   289  
   290  func (ResolverRuleArray) ElementType() reflect.Type {
   291  	return reflect.TypeOf((*[]*ResolverRule)(nil)).Elem()
   292  }
   293  
   294  func (i ResolverRuleArray) ToResolverRuleArrayOutput() ResolverRuleArrayOutput {
   295  	return i.ToResolverRuleArrayOutputWithContext(context.Background())
   296  }
   297  
   298  func (i ResolverRuleArray) ToResolverRuleArrayOutputWithContext(ctx context.Context) ResolverRuleArrayOutput {
   299  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleArrayOutput)
   300  }
   301  
   302  // ResolverRuleMapInput is an input type that accepts ResolverRuleMap and ResolverRuleMapOutput values.
   303  // You can construct a concrete instance of `ResolverRuleMapInput` via:
   304  //
   305  //	ResolverRuleMap{ "key": ResolverRuleArgs{...} }
   306  type ResolverRuleMapInput interface {
   307  	pulumi.Input
   308  
   309  	ToResolverRuleMapOutput() ResolverRuleMapOutput
   310  	ToResolverRuleMapOutputWithContext(context.Context) ResolverRuleMapOutput
   311  }
   312  
   313  type ResolverRuleMap map[string]ResolverRuleInput
   314  
   315  func (ResolverRuleMap) ElementType() reflect.Type {
   316  	return reflect.TypeOf((*map[string]*ResolverRule)(nil)).Elem()
   317  }
   318  
   319  func (i ResolverRuleMap) ToResolverRuleMapOutput() ResolverRuleMapOutput {
   320  	return i.ToResolverRuleMapOutputWithContext(context.Background())
   321  }
   322  
   323  func (i ResolverRuleMap) ToResolverRuleMapOutputWithContext(ctx context.Context) ResolverRuleMapOutput {
   324  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleMapOutput)
   325  }
   326  
   327  type ResolverRuleOutput struct{ *pulumi.OutputState }
   328  
   329  func (ResolverRuleOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((**ResolverRule)(nil)).Elem()
   331  }
   332  
   333  func (o ResolverRuleOutput) ToResolverRuleOutput() ResolverRuleOutput {
   334  	return o
   335  }
   336  
   337  func (o ResolverRuleOutput) ToResolverRuleOutputWithContext(ctx context.Context) ResolverRuleOutput {
   338  	return o
   339  }
   340  
   341  // The ARN (Amazon Resource Name) for the resolver rule.
   342  func (o ResolverRuleOutput) Arn() pulumi.StringOutput {
   343  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   344  }
   345  
   346  // DNS queries for this domain name are forwarded to the IP addresses that are specified using `targetIp`.
   347  func (o ResolverRuleOutput) DomainName() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   349  }
   350  
   351  // A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
   352  func (o ResolverRuleOutput) Name() pulumi.StringOutput {
   353  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   354  }
   355  
   356  // When a rule is shared with another AWS account, the account ID of the account that the rule is shared with.
   357  func (o ResolverRuleOutput) OwnerId() pulumi.StringOutput {
   358  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)
   359  }
   360  
   361  // The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using `targetIp`.
   362  // This argument should only be specified for `FORWARD` type rules.
   363  func (o ResolverRuleOutput) ResolverEndpointId() pulumi.StringPtrOutput {
   364  	return o.ApplyT(func(v *ResolverRule) pulumi.StringPtrOutput { return v.ResolverEndpointId }).(pulumi.StringPtrOutput)
   365  }
   366  
   367  // The rule type. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   368  func (o ResolverRuleOutput) RuleType() pulumi.StringOutput {
   369  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.RuleType }).(pulumi.StringOutput)
   370  }
   371  
   372  // Whether the rules is shared and, if so, whether the current account is sharing the rule with another account, or another account is sharing the rule with the current account.
   373  // Values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   374  func (o ResolverRuleOutput) ShareStatus() pulumi.StringOutput {
   375  	return o.ApplyT(func(v *ResolverRule) pulumi.StringOutput { return v.ShareStatus }).(pulumi.StringOutput)
   376  }
   377  
   378  // A 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.
   379  func (o ResolverRuleOutput) Tags() pulumi.StringMapOutput {
   380  	return o.ApplyT(func(v *ResolverRule) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   381  }
   382  
   383  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   384  //
   385  // Deprecated: Please use `tags` instead.
   386  func (o ResolverRuleOutput) TagsAll() pulumi.StringMapOutput {
   387  	return o.ApplyT(func(v *ResolverRule) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   388  }
   389  
   390  // Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below).
   391  // This argument should only be specified for `FORWARD` type rules.
   392  func (o ResolverRuleOutput) TargetIps() ResolverRuleTargetIpArrayOutput {
   393  	return o.ApplyT(func(v *ResolverRule) ResolverRuleTargetIpArrayOutput { return v.TargetIps }).(ResolverRuleTargetIpArrayOutput)
   394  }
   395  
   396  type ResolverRuleArrayOutput struct{ *pulumi.OutputState }
   397  
   398  func (ResolverRuleArrayOutput) ElementType() reflect.Type {
   399  	return reflect.TypeOf((*[]*ResolverRule)(nil)).Elem()
   400  }
   401  
   402  func (o ResolverRuleArrayOutput) ToResolverRuleArrayOutput() ResolverRuleArrayOutput {
   403  	return o
   404  }
   405  
   406  func (o ResolverRuleArrayOutput) ToResolverRuleArrayOutputWithContext(ctx context.Context) ResolverRuleArrayOutput {
   407  	return o
   408  }
   409  
   410  func (o ResolverRuleArrayOutput) Index(i pulumi.IntInput) ResolverRuleOutput {
   411  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResolverRule {
   412  		return vs[0].([]*ResolverRule)[vs[1].(int)]
   413  	}).(ResolverRuleOutput)
   414  }
   415  
   416  type ResolverRuleMapOutput struct{ *pulumi.OutputState }
   417  
   418  func (ResolverRuleMapOutput) ElementType() reflect.Type {
   419  	return reflect.TypeOf((*map[string]*ResolverRule)(nil)).Elem()
   420  }
   421  
   422  func (o ResolverRuleMapOutput) ToResolverRuleMapOutput() ResolverRuleMapOutput {
   423  	return o
   424  }
   425  
   426  func (o ResolverRuleMapOutput) ToResolverRuleMapOutputWithContext(ctx context.Context) ResolverRuleMapOutput {
   427  	return o
   428  }
   429  
   430  func (o ResolverRuleMapOutput) MapIndex(k pulumi.StringInput) ResolverRuleOutput {
   431  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResolverRule {
   432  		return vs[0].(map[string]*ResolverRule)[vs[1].(string)]
   433  	}).(ResolverRuleOutput)
   434  }
   435  
   436  func init() {
   437  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleInput)(nil)).Elem(), &ResolverRule{})
   438  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleArrayInput)(nil)).Elem(), ResolverRuleArray{})
   439  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleMapInput)(nil)).Elem(), ResolverRuleMap{})
   440  	pulumi.RegisterOutputType(ResolverRuleOutput{})
   441  	pulumi.RegisterOutputType(ResolverRuleArrayOutput{})
   442  	pulumi.RegisterOutputType(ResolverRuleMapOutput{})
   443  }