Does anyone know if the <documentation about Provd...
# aws
a
Does anyone know if the documentation about ProvderDefaultTags is accurate? In particular:
Can also be configured with environment variables like
TF_AWS_DEFAULT_TAGS_<tag_name>
.
Before I chase my tail, just wondering if that's an artifact from the Terraform documentation that doesn't actually apply to Pulumi (or, perhaps, is it
PULUMI_AWS_DEFAULT_TAG_<tag_name>
?
Looks like it's trying to do something with the
TF_AWS...
environment variables, but the behaviour is strange. For example, I'm setting:
Copy code
TF_AWS_DEFAULT_TAGS_abc:bus:owner=Cloud Platforms
The diff is showing it's trying to add the key, but the value is `<null>`:
Copy code
[provider=urn:pulumi:abc-coreinfrastructure-non-prod::abc-cp-vpc::pulumi:providers:aws::default_7_11_0::f1f82671-10ff-42b0-b4f0-2522f24fa3bf]
                  ~ tagsAll: {
                      + abc:bus:owner         : <null>
...
s
How are you setting the environment variable? It seems like it probably has to do with the ":"s. When I set the variable in your example, I get
Copy code
> export TF_AWS_DEFAULT_TAGS_abc:bus:owner=Cloud Platforms
      export: not valid in this context: TF_AWS_DEFAULT_TAGS_abc:bus:owner
You'll likely also need to put "Cloud Platforms" in quotations so it grabs the whole string
a
Thanks for responding Elisabeth! We're using Azure DevOps Pipelines, and we have a nearly identical setup for our Terraform pipeline which is working.. Here's what's there now - I'll try adding the quotes:
Copy code
- script: |
          env | sort
          pulumi login
          pulumi stack select ${{parameters.stackName}}
          pulumi preview --diff
        env:
          PULUMI_BACKEND_URL: ${{parameters.stateBackend}}
          TF_AWS_DEFAULT_TAGS_abc:ops:applicationid: $(TAGS_abc_ops_applicationid)
          TF_AWS_DEFAULT_TAGS_abc:ops:managedby: $(TAGS_abc_ops_managedby)
          TF_AWS_DEFAULT_TAGS_abc:bus:costcenter: $(TAGS_abc_bus_costcenter)
          TF_AWS_DEFAULT_TAGS_abc:bus:owner: $(TAGS_abc_bus_owner)
          TF_AWS_DEFAULT_TAGS_abc:bus:product: $(TAGS_abc_bus_product)
          TF_AWS_DEFAULT_TAGS_abc:bus:criticality: $(TAGS_abc_bus_criticality)
          TF_AWS_DEFAULT_TAGS_abc:tech:environment: $(TAGS_abc_tech_environment)
          TF_AWS_DEFAULT_TAGS_abc:sec:classification: $(TAGS_abc_sec_classification)
          TF_AWS_DEFAULT_TAGS_abc:ops:repo: $(Build.Repository.Uri)
          TF_AWS_DEFAULT_TAGS_abc:tech:createdby: pulumi
TAGS_abc...
is being set earlier in the pipeline by looking them up from an external resource. You're right, though, 'export ...` with colons definitely doesn't work, but setting the env seems OK (e.g.,
TF_AWS_DEFAULT_TAGS_abc:ops:managedby pulumi preview ...
is valid, which I think is what the
env
statement is doing)
The plot thickens.. I'm doing something else further down in the program:
Copy code
default_tags=aws.ProviderDefaultTagsArgs(
                    tags=aws.get_default_tags().tags,
                ),
And that is picking up the tag values.... 🤔
OK.. All the
<nulls>
in the preview output seem to be bogus - I ran the
up
and it actually did add the tags.. Small bug in the preview rendering I guess?
a
Hey @astonishing-oil-84546, thanks for raising this. I've opened an issue for the problem: https://github.com/pulumi/pulumi-aws/issues/6002 It's a rather deep problem, unfortunately, but the report is appreciated!
a
🙏 Yeah - was a strange one.. Glad it's (to me) simply a display issue. Thanks for raising the report!