github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53domains/delegationSignerRecord.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 route53domains
     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 resource to manage a [delegation signer record](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-configuring-dnssec-enable-signing.html#dns-configuring-dnssec-enable-signing-step-1) in the parent DNS zone for domains registered with Route53.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"encoding/json"
    28  //	"fmt"
    29  //
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    31  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    32  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    33  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53domains"
    34  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    35  //
    36  // )
    37  //
    38  //	func main() {
    39  //		pulumi.Run(func(ctx *pulumi.Context) error {
    40  //			current, err := aws.GetCallerIdentity(ctx, nil, nil)
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    45  //				"Statement": []interface{}{
    46  //					map[string]interface{}{
    47  //						"Action": []string{
    48  //							"kms:DescribeKey",
    49  //							"kms:GetPublicKey",
    50  //							"kms:Sign",
    51  //						},
    52  //						"Effect": "Allow",
    53  //						"Principal": map[string]interface{}{
    54  //							"Service": "dnssec-route53.amazonaws.com",
    55  //						},
    56  //						"Sid":      "Allow Route 53 DNSSEC Service",
    57  //						"Resource": "*",
    58  //						"Condition": map[string]interface{}{
    59  //							"StringEquals": map[string]interface{}{
    60  //								"aws:SourceAccount": current.AccountId,
    61  //							},
    62  //							"ArnLike": map[string]interface{}{
    63  //								"aws:SourceArn": "arn:aws:route53:::hostedzone/*",
    64  //							},
    65  //						},
    66  //					},
    67  //					map[string]interface{}{
    68  //						"Action": "kms:CreateGrant",
    69  //						"Effect": "Allow",
    70  //						"Principal": map[string]interface{}{
    71  //							"Service": "dnssec-route53.amazonaws.com",
    72  //						},
    73  //						"Sid":      "Allow Route 53 DNSSEC Service to CreateGrant",
    74  //						"Resource": "*",
    75  //						"Condition": map[string]interface{}{
    76  //							"Bool": map[string]interface{}{
    77  //								"kms:GrantIsForAWSResource": "true",
    78  //							},
    79  //						},
    80  //					},
    81  //					map[string]interface{}{
    82  //						"Action": "kms:*",
    83  //						"Effect": "Allow",
    84  //						"Principal": map[string]interface{}{
    85  //							"AWS": fmt.Sprintf("arn:aws:iam::%v:root", current.AccountId),
    86  //						},
    87  //						"Resource": "*",
    88  //						"Sid":      "Enable IAM User Permissions",
    89  //					},
    90  //				},
    91  //				"Version": "2012-10-17",
    92  //			})
    93  //			if err != nil {
    94  //				return err
    95  //			}
    96  //			json0 := string(tmpJSON0)
    97  //			_, err = kms.NewKey(ctx, "example", &kms.KeyArgs{
    98  //				CustomerMasterKeySpec: pulumi.String("ECC_NIST_P256"),
    99  //				DeletionWindowInDays:  pulumi.Int(7),
   100  //				KeyUsage:              pulumi.String("SIGN_VERIFY"),
   101  //				Policy:                pulumi.String(json0),
   102  //			})
   103  //			if err != nil {
   104  //				return err
   105  //			}
   106  //			_, err = route53.NewZone(ctx, "example", &route53.ZoneArgs{
   107  //				Name: pulumi.String("example.com"),
   108  //			})
   109  //			if err != nil {
   110  //				return err
   111  //			}
   112  //			exampleKeySigningKey, err := route53.NewKeySigningKey(ctx, "example", &route53.KeySigningKeyArgs{
   113  //				HostedZoneId:            pulumi.Any(test.Id),
   114  //				KeyManagementServiceArn: pulumi.Any(testAwsKmsKey.Arn),
   115  //				Name:                    pulumi.String("example"),
   116  //			})
   117  //			if err != nil {
   118  //				return err
   119  //			}
   120  //			_, err = route53.NewHostedZoneDnsSec(ctx, "example", &route53.HostedZoneDnsSecArgs{
   121  //				HostedZoneId: exampleKeySigningKey.HostedZoneId,
   122  //			}, pulumi.DependsOn([]pulumi.Resource{
   123  //				exampleKeySigningKey,
   124  //			}))
   125  //			if err != nil {
   126  //				return err
   127  //			}
   128  //			_, err = route53domains.NewDelegationSignerRecord(ctx, "example", &route53domains.DelegationSignerRecordArgs{
   129  //				DomainName: pulumi.String("example.com"),
   130  //				SigningAttributes: &route53domains.DelegationSignerRecordSigningAttributesArgs{
   131  //					Algorithm: exampleKeySigningKey.SigningAlgorithmType,
   132  //					Flags:     exampleKeySigningKey.Flag,
   133  //					PublicKey: exampleKeySigningKey.PublicKey,
   134  //				},
   135  //			})
   136  //			if err != nil {
   137  //				return err
   138  //			}
   139  //			return nil
   140  //		})
   141  //	}
   142  //
   143  // ```
   144  // <!--End PulumiCodeChooser -->
   145  //
   146  // ## Import
   147  //
   148  // Using `pulumi import`, import delegation signer records using the domain name and DNSSEC key ID, separated by a comma (`,`). For example:
   149  //
   150  // ```sh
   151  // $ pulumi import aws:route53domains/delegationSignerRecord:DelegationSignerRecord example example.com,40DE3534F5324DBDAC598ACEDB5B1E26A5368732D9C791D1347E4FBDDF6FC343
   152  // ```
   153  type DelegationSignerRecord struct {
   154  	pulumi.CustomResourceState
   155  
   156  	// An ID assigned to the created DS record.
   157  	DnssecKeyId pulumi.StringOutput `pulumi:"dnssecKeyId"`
   158  	// The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   159  	DomainName pulumi.StringOutput `pulumi:"domainName"`
   160  	// The information about a key, including the algorithm, public key-value, and flags.
   161  	SigningAttributes DelegationSignerRecordSigningAttributesPtrOutput `pulumi:"signingAttributes"`
   162  	Timeouts          DelegationSignerRecordTimeoutsPtrOutput          `pulumi:"timeouts"`
   163  }
   164  
   165  // NewDelegationSignerRecord registers a new resource with the given unique name, arguments, and options.
   166  func NewDelegationSignerRecord(ctx *pulumi.Context,
   167  	name string, args *DelegationSignerRecordArgs, opts ...pulumi.ResourceOption) (*DelegationSignerRecord, error) {
   168  	if args == nil {
   169  		return nil, errors.New("missing one or more required arguments")
   170  	}
   171  
   172  	if args.DomainName == nil {
   173  		return nil, errors.New("invalid value for required argument 'DomainName'")
   174  	}
   175  	opts = internal.PkgResourceDefaultOpts(opts)
   176  	var resource DelegationSignerRecord
   177  	err := ctx.RegisterResource("aws:route53domains/delegationSignerRecord:DelegationSignerRecord", name, args, &resource, opts...)
   178  	if err != nil {
   179  		return nil, err
   180  	}
   181  	return &resource, nil
   182  }
   183  
   184  // GetDelegationSignerRecord gets an existing DelegationSignerRecord resource's state with the given name, ID, and optional
   185  // state properties that are used to uniquely qualify the lookup (nil if not required).
   186  func GetDelegationSignerRecord(ctx *pulumi.Context,
   187  	name string, id pulumi.IDInput, state *DelegationSignerRecordState, opts ...pulumi.ResourceOption) (*DelegationSignerRecord, error) {
   188  	var resource DelegationSignerRecord
   189  	err := ctx.ReadResource("aws:route53domains/delegationSignerRecord:DelegationSignerRecord", name, id, state, &resource, opts...)
   190  	if err != nil {
   191  		return nil, err
   192  	}
   193  	return &resource, nil
   194  }
   195  
   196  // Input properties used for looking up and filtering DelegationSignerRecord resources.
   197  type delegationSignerRecordState struct {
   198  	// An ID assigned to the created DS record.
   199  	DnssecKeyId *string `pulumi:"dnssecKeyId"`
   200  	// The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   201  	DomainName *string `pulumi:"domainName"`
   202  	// The information about a key, including the algorithm, public key-value, and flags.
   203  	SigningAttributes *DelegationSignerRecordSigningAttributes `pulumi:"signingAttributes"`
   204  	Timeouts          *DelegationSignerRecordTimeouts          `pulumi:"timeouts"`
   205  }
   206  
   207  type DelegationSignerRecordState struct {
   208  	// An ID assigned to the created DS record.
   209  	DnssecKeyId pulumi.StringPtrInput
   210  	// The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   211  	DomainName pulumi.StringPtrInput
   212  	// The information about a key, including the algorithm, public key-value, and flags.
   213  	SigningAttributes DelegationSignerRecordSigningAttributesPtrInput
   214  	Timeouts          DelegationSignerRecordTimeoutsPtrInput
   215  }
   216  
   217  func (DelegationSignerRecordState) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*delegationSignerRecordState)(nil)).Elem()
   219  }
   220  
   221  type delegationSignerRecordArgs struct {
   222  	// The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   223  	DomainName string `pulumi:"domainName"`
   224  	// The information about a key, including the algorithm, public key-value, and flags.
   225  	SigningAttributes *DelegationSignerRecordSigningAttributes `pulumi:"signingAttributes"`
   226  	Timeouts          *DelegationSignerRecordTimeouts          `pulumi:"timeouts"`
   227  }
   228  
   229  // The set of arguments for constructing a DelegationSignerRecord resource.
   230  type DelegationSignerRecordArgs struct {
   231  	// The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   232  	DomainName pulumi.StringInput
   233  	// The information about a key, including the algorithm, public key-value, and flags.
   234  	SigningAttributes DelegationSignerRecordSigningAttributesPtrInput
   235  	Timeouts          DelegationSignerRecordTimeoutsPtrInput
   236  }
   237  
   238  func (DelegationSignerRecordArgs) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*delegationSignerRecordArgs)(nil)).Elem()
   240  }
   241  
   242  type DelegationSignerRecordInput interface {
   243  	pulumi.Input
   244  
   245  	ToDelegationSignerRecordOutput() DelegationSignerRecordOutput
   246  	ToDelegationSignerRecordOutputWithContext(ctx context.Context) DelegationSignerRecordOutput
   247  }
   248  
   249  func (*DelegationSignerRecord) ElementType() reflect.Type {
   250  	return reflect.TypeOf((**DelegationSignerRecord)(nil)).Elem()
   251  }
   252  
   253  func (i *DelegationSignerRecord) ToDelegationSignerRecordOutput() DelegationSignerRecordOutput {
   254  	return i.ToDelegationSignerRecordOutputWithContext(context.Background())
   255  }
   256  
   257  func (i *DelegationSignerRecord) ToDelegationSignerRecordOutputWithContext(ctx context.Context) DelegationSignerRecordOutput {
   258  	return pulumi.ToOutputWithContext(ctx, i).(DelegationSignerRecordOutput)
   259  }
   260  
   261  // DelegationSignerRecordArrayInput is an input type that accepts DelegationSignerRecordArray and DelegationSignerRecordArrayOutput values.
   262  // You can construct a concrete instance of `DelegationSignerRecordArrayInput` via:
   263  //
   264  //	DelegationSignerRecordArray{ DelegationSignerRecordArgs{...} }
   265  type DelegationSignerRecordArrayInput interface {
   266  	pulumi.Input
   267  
   268  	ToDelegationSignerRecordArrayOutput() DelegationSignerRecordArrayOutput
   269  	ToDelegationSignerRecordArrayOutputWithContext(context.Context) DelegationSignerRecordArrayOutput
   270  }
   271  
   272  type DelegationSignerRecordArray []DelegationSignerRecordInput
   273  
   274  func (DelegationSignerRecordArray) ElementType() reflect.Type {
   275  	return reflect.TypeOf((*[]*DelegationSignerRecord)(nil)).Elem()
   276  }
   277  
   278  func (i DelegationSignerRecordArray) ToDelegationSignerRecordArrayOutput() DelegationSignerRecordArrayOutput {
   279  	return i.ToDelegationSignerRecordArrayOutputWithContext(context.Background())
   280  }
   281  
   282  func (i DelegationSignerRecordArray) ToDelegationSignerRecordArrayOutputWithContext(ctx context.Context) DelegationSignerRecordArrayOutput {
   283  	return pulumi.ToOutputWithContext(ctx, i).(DelegationSignerRecordArrayOutput)
   284  }
   285  
   286  // DelegationSignerRecordMapInput is an input type that accepts DelegationSignerRecordMap and DelegationSignerRecordMapOutput values.
   287  // You can construct a concrete instance of `DelegationSignerRecordMapInput` via:
   288  //
   289  //	DelegationSignerRecordMap{ "key": DelegationSignerRecordArgs{...} }
   290  type DelegationSignerRecordMapInput interface {
   291  	pulumi.Input
   292  
   293  	ToDelegationSignerRecordMapOutput() DelegationSignerRecordMapOutput
   294  	ToDelegationSignerRecordMapOutputWithContext(context.Context) DelegationSignerRecordMapOutput
   295  }
   296  
   297  type DelegationSignerRecordMap map[string]DelegationSignerRecordInput
   298  
   299  func (DelegationSignerRecordMap) ElementType() reflect.Type {
   300  	return reflect.TypeOf((*map[string]*DelegationSignerRecord)(nil)).Elem()
   301  }
   302  
   303  func (i DelegationSignerRecordMap) ToDelegationSignerRecordMapOutput() DelegationSignerRecordMapOutput {
   304  	return i.ToDelegationSignerRecordMapOutputWithContext(context.Background())
   305  }
   306  
   307  func (i DelegationSignerRecordMap) ToDelegationSignerRecordMapOutputWithContext(ctx context.Context) DelegationSignerRecordMapOutput {
   308  	return pulumi.ToOutputWithContext(ctx, i).(DelegationSignerRecordMapOutput)
   309  }
   310  
   311  type DelegationSignerRecordOutput struct{ *pulumi.OutputState }
   312  
   313  func (DelegationSignerRecordOutput) ElementType() reflect.Type {
   314  	return reflect.TypeOf((**DelegationSignerRecord)(nil)).Elem()
   315  }
   316  
   317  func (o DelegationSignerRecordOutput) ToDelegationSignerRecordOutput() DelegationSignerRecordOutput {
   318  	return o
   319  }
   320  
   321  func (o DelegationSignerRecordOutput) ToDelegationSignerRecordOutputWithContext(ctx context.Context) DelegationSignerRecordOutput {
   322  	return o
   323  }
   324  
   325  // An ID assigned to the created DS record.
   326  func (o DelegationSignerRecordOutput) DnssecKeyId() pulumi.StringOutput {
   327  	return o.ApplyT(func(v *DelegationSignerRecord) pulumi.StringOutput { return v.DnssecKeyId }).(pulumi.StringOutput)
   328  }
   329  
   330  // The name of the domain that will have its parent DNS zone updated with the Delegation Signer record.
   331  func (o DelegationSignerRecordOutput) DomainName() pulumi.StringOutput {
   332  	return o.ApplyT(func(v *DelegationSignerRecord) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   333  }
   334  
   335  // The information about a key, including the algorithm, public key-value, and flags.
   336  func (o DelegationSignerRecordOutput) SigningAttributes() DelegationSignerRecordSigningAttributesPtrOutput {
   337  	return o.ApplyT(func(v *DelegationSignerRecord) DelegationSignerRecordSigningAttributesPtrOutput {
   338  		return v.SigningAttributes
   339  	}).(DelegationSignerRecordSigningAttributesPtrOutput)
   340  }
   341  
   342  func (o DelegationSignerRecordOutput) Timeouts() DelegationSignerRecordTimeoutsPtrOutput {
   343  	return o.ApplyT(func(v *DelegationSignerRecord) DelegationSignerRecordTimeoutsPtrOutput { return v.Timeouts }).(DelegationSignerRecordTimeoutsPtrOutput)
   344  }
   345  
   346  type DelegationSignerRecordArrayOutput struct{ *pulumi.OutputState }
   347  
   348  func (DelegationSignerRecordArrayOutput) ElementType() reflect.Type {
   349  	return reflect.TypeOf((*[]*DelegationSignerRecord)(nil)).Elem()
   350  }
   351  
   352  func (o DelegationSignerRecordArrayOutput) ToDelegationSignerRecordArrayOutput() DelegationSignerRecordArrayOutput {
   353  	return o
   354  }
   355  
   356  func (o DelegationSignerRecordArrayOutput) ToDelegationSignerRecordArrayOutputWithContext(ctx context.Context) DelegationSignerRecordArrayOutput {
   357  	return o
   358  }
   359  
   360  func (o DelegationSignerRecordArrayOutput) Index(i pulumi.IntInput) DelegationSignerRecordOutput {
   361  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DelegationSignerRecord {
   362  		return vs[0].([]*DelegationSignerRecord)[vs[1].(int)]
   363  	}).(DelegationSignerRecordOutput)
   364  }
   365  
   366  type DelegationSignerRecordMapOutput struct{ *pulumi.OutputState }
   367  
   368  func (DelegationSignerRecordMapOutput) ElementType() reflect.Type {
   369  	return reflect.TypeOf((*map[string]*DelegationSignerRecord)(nil)).Elem()
   370  }
   371  
   372  func (o DelegationSignerRecordMapOutput) ToDelegationSignerRecordMapOutput() DelegationSignerRecordMapOutput {
   373  	return o
   374  }
   375  
   376  func (o DelegationSignerRecordMapOutput) ToDelegationSignerRecordMapOutputWithContext(ctx context.Context) DelegationSignerRecordMapOutput {
   377  	return o
   378  }
   379  
   380  func (o DelegationSignerRecordMapOutput) MapIndex(k pulumi.StringInput) DelegationSignerRecordOutput {
   381  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DelegationSignerRecord {
   382  		return vs[0].(map[string]*DelegationSignerRecord)[vs[1].(string)]
   383  	}).(DelegationSignerRecordOutput)
   384  }
   385  
   386  func init() {
   387  	pulumi.RegisterInputType(reflect.TypeOf((*DelegationSignerRecordInput)(nil)).Elem(), &DelegationSignerRecord{})
   388  	pulumi.RegisterInputType(reflect.TypeOf((*DelegationSignerRecordArrayInput)(nil)).Elem(), DelegationSignerRecordArray{})
   389  	pulumi.RegisterInputType(reflect.TypeOf((*DelegationSignerRecordMapInput)(nil)).Elem(), DelegationSignerRecordMap{})
   390  	pulumi.RegisterOutputType(DelegationSignerRecordOutput{})
   391  	pulumi.RegisterOutputType(DelegationSignerRecordArrayOutput{})
   392  	pulumi.RegisterOutputType(DelegationSignerRecordMapOutput{})
   393  }