Yu-Jack / yu-jack.github.io

This is a blog.
https://yu-jack.github.io/
9 stars 0 forks source link

pulumi setting #11

Open Yu-Jack opened 2 years ago

Yu-Jack commented 2 years ago

How to let pulumi read latest data ?

By default, pulumi doesn't refresh. You should run it by pulumi refresh or pulumi run --refresh

https://github.com/pulumi/pulumi/issues/3664#issuecomment-566194894

Yu-Jack commented 2 years ago

pulumi aws route53 setting

If there is a SetIdentifier, you should append it by _, like below example.

{
      "type": "aws:route53/record:Record",
      "name": "{name for pulumi to manage}",
      "id": "{zone_id}_{name from route53}_{record_type}_{identifier}"
}

If your identifier is Europe - Lambda,you should append it like this.

{
      "type": "aws:route53/record:Record",
      "name": "{name for pulumi to manage}",
      "id": "{zone_id}_{name from route53}_{record_type}_Europe - Lambda"
}
Yu-Jack commented 2 years ago

pulumi execution order

Pulumi has execution order. For example, we want to use pulumi to create route53 Zone and Record. We should create Zone first, then assign zone id to Record.

This is official example from https://www.pulumi.com/registry/packages/aws/api-docs/route53/zone/#public-subdomain-zone.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const main = new aws.route53.Zone("main", {});
const dev = new aws.route53.Zone("dev", {tags: {
    Environment: "dev",
}});
const dev_ns = new aws.route53.Record("dev-ns", {
    zoneId: main.zoneId,
    name: "dev.example.com",
    type: "NS",
    ttl: "30",
    records: dev.nameServers,
});

Then, after you execute pulumi up, you'll see there is a zoneId : output<string>. That means pulumi doesn't create zone yet, pulumi mark this field will be accept value from some previous output.