pulumi/examples

Tags not read when importing with defaultTags

Fydon opened this issue · 1 comments

Fydon commented

What happened?

I set aws.Provider's defaultTags and then tried some imports. Some work, but some are failing as it claims that tags don't match in spite of tags being present.

For AWS Backup Plans, calling aws backup get-backup-plan does not return tags (doc). To get tags, aws backup list-tags needs to be called (doc). Even though I've set the tags on a backup plan, it won't import because it claims the tags are missing. Using the above commands, I can get the tags so they are set. Could the underlying code be failing to perform the extra step to get tags when importing?

I'm experiencing the same problem with Backup Vaults and Roles. For Vaults, aws backup describe-backup-vault (doc) doesn't return tags but again aws backup list-tags does. For Roles, aws iam get-role does return tags.

Example

To keep this simple, I'll just provide the vault

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

const provider = new aws.Provider(
  'provider-us-east-1',
  {
    defaultTags: {
      tags: {
        'pulumi:project': pulumi.getProject(),
        'pulumi:stack': pulumi.getStack(),
      },
    },
    profile: 'aws',
    region: 'us-east-1',
  }
);

const vault = new aws.backup.Vault(
  'productionVault',
  {
    name: 'production',
  },
  {
    import: 'production',
    parent: provider,
    provider,
  }
);

Output of pulumi about

CLI
Version      3.102.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME    VERSION
aws     6.18.2
nodejs  unknown

Host
OS       Microsoft Windows 11 Pro
Version  10.0.22631 Build 22631
Arch     x86_64

This project is written in nodejs: executable='C:\Program Files\nodejs\node.exe' version='v16.15.0'

Additional context

When removing defaultTags, I had to remove the tags to allow the import to proceed.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Fydon commented

Sorry I created this in the wrong repository. I've moved it to pulumi-aws.