careful-carpet-52948
09/16/2025, 3:52 AMerror: failed to make http request: POST "<https://api.cloudflare.com/client/v4/zones/186b216107482ba7a7554f86411341ec/dns_records>": 401 Unauthorized
{
"success":false,
"errors": [
{
"code":10000,
"message":"Authentication error"
}
]
}
When i try to do the same thing in Postman it works fine.
My Pulumi code:
ts
const cloudflareProvider = new cloudflare.Provider('cf', {
apiToken: '<token>',
});
const cloudflareDomain = new cloudflare.DnsRecord(
`${resourcePrefix}-cloudflare-domain`,
{
name: domainPrefix,
content: cloudfrontDistribution.domainName, // lines to the A record of the cloudfront distribution
type: 'CNAME',
ttl: 1,
zoneId: zoneId,
proxied: true,
comment: `CNAME record for ${domainPrefix} pointing to Cloudfront distribution ${cloudfrontDistribution.domainName}`,
},
{
dependsOn: [cloudfrontDistribution],
provider: cloudflareProvider,
}
);numerous-tiger-71828
09/20/2025, 2:25 AMnumerous-tiger-71828
09/20/2025, 2:25 AMnumerous-tiger-71828
09/20/2025, 5:11 AMAccepted Permissions (at least one required)
DNS Write
https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/create/.
I realized that I configured DNS views, DNS settings permissions by using Account API tokens, but I didn't add zone level permission, so I tried to add new Zone level permission for DNS-Edit and also configured Zone resources. And the code works now.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by