Thread
#getting-started
    r

    rhythmic-branch-12845

    2 months ago
    I’m not exactly getting a good experience from my first actual Pulumi program:
    Do you want to perform this update? yes
    Updating (stage)
    
    View Live: <https://app.pulumi.com/jf/xxxxxxx/stage/updates/1>
    
         Type                 Name           Status                  Info
     +   pulumi:pulumi:Stack  xxxxxxx-stage  **creating failed**     1 error
     +   └─ aws:route53:Zone  main           **creating failed**     1 error
    
    Diagnostics:
      pulumi:pulumi:Stack (xxxxxxx-stage):
        error: update failed
    
      aws:route53:Zone (main):
        error: 1 error occurred:
            * error creating Route53 Hosted Zone: InvalidDomainName: main-468bb55 is reserved by AWS!
            status code: 400, request id: ...
    Resources:
        + 1 created
    
    Duration: 4s
    I’m just trying to create a route53 zone, and I see absolutely no signs or warnings anywhere in the doc about what
    name
    is supposed to even mean, or what namespace it’s supposed to be in (https://www.pulumi.com/registry/packages/aws/api-docs/route53/zone/) This is my program:
    """An AWS Python Pulumi program"""
    
    import pulumi
    import pulumi_aws as aws
    
    main = aws.route53.Zone("main", tags={ "mananged_by": "Pulumi" })
    
    pulumi.export('route53_Zone__main__name_servers', main.name_servers)
    (and for the record, changing
    main
    to
    primary
    gives me no joy either: I get basically the same error, just with “primary” in place of “main”
    😡😡😡 this should ahve been logical, except that the docs don’t really make it clear (“The unique name of the resource.“?) Turns out this is the actual domain name
    l

    limited-rainbow-51650

    2 months ago
    Hello @rhythmic-branch-12845, because most providers have a flat namespace, Pulumi applies an auto-naming technique which takes the logical name and suffixes it with a hash, this to prevent collisions when multiple stacks are created in e.g. the same AWS account. However, in some cases like S3 bucket names or Route53 domain names, you want to take control of the physical name as well. In such cases, you can pass the physical resource name as well. For Route53, this should look like:
    """An AWS Python Pulumi program"""
    
    import pulumi
    import pulumi_aws as aws
    
    main = aws.route53.Zone("main", name="top.level.domain", tags={ "mananged_by": "Pulumi" })
    
    pulumi.export('route53_Zone__main__name_servers', main.name_servers)
    r

    rhythmic-branch-12845

    2 months ago
    sorry, actually no (and this is the confusing bit):
    resource_name
    isn’t even the real domain name; Pulumi adds some ridiculous suffix to it, so that the actual domain you create has some suffix like (in my case
    -2e9f86f
    )… Seriously. 1. the doc should just give a proper example. You need to supply the
    name
    parameter! (aws.route53.Zone(name=“example.com”, …)`) 2. the required
    resource_name
    parameter is just a trap. What is it for? as mentioned, it does absolutely nothing useful (if it’s used for the actual domain name, then it produces a useless zone because of the suffix; if
    name=
    is supplied, why would we care?
    thanks, @limited-rainbow-51650. Was just typing this up as your answer came in. I figured it out, but honestly… not a good experience
    l

    limited-rainbow-51650

    2 months ago
    The
    resource_name
    is how Pulumi identifies the resource under management in the state file. If you go through that page on
    Resource Names
    I linked higher up, I hope it makes things clear for you. Do reach out if you would still have any questions.
    r

    rhythmic-branch-12845

    2 months ago
    thanks. I do have 2 other questions above this one if you don’t mind
    e

    echoing-dinner-19531

    2 months ago
    Do feel free to ask questions 🙂 you don't need permission to ask away