Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tfgen does not recognise all new resources #2372

Closed
squaremo opened this issue Feb 16, 2023 · 1 comment
Closed

tfgen does not recognise all new resources #2372

squaremo opened this issue Feb 16, 2023 · 1 comment
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@squaremo
Copy link
Contributor

In the playbook for updating a Terraform-bridged provider (in a private repo; the relevant bits are reproduced below), step 7 says:

Check the upstream provider CHANGELOG or release notes. For each new resource, add the appropriate mapping in resources.go. Add to the bottom of the relevant section by convention.

Then step 9 says:

make tfgen <-- check the output for unmapped resources and data sources and add to the provider map (normally provider/resources.go)

When I followed these steps for pulumi-aws, updating to the upstream v4.54.0 (https://github.com/pulumi/terraform-provider-aws/tree/patched-v4.54.0), I added new resources and data sources mentioned in the changelog (https://github.com/pulumi/terraform-provider-aws/blob/patched-v4.54.0/CHANGELOG.md):

NB These are mentioned under v4.53.0; the prior update branch was v4.52.0).

When I subsequently ran make tfgen, it complained that the resources shouldn't be in provider/resources.go:

error: failed to gather package metadata: problem gathering resources: 3 errors occurred:
	* Pulumi token "aws:auditmanager/assessmentDelegation:AssessmentDelegation" is mapped to TF provider resource "aws_auditmanager_assessment_delegation", but no such resource found. The mapping will be ignored in the generated provider
	* Pulumi token "aws:auditmanager/frameworkShare:FrameworkShare" is mapped to TF provider resource "aws_auditmanager_framework_share", but no such resource found. The mapping will be ignored in the generated provider
	* Pulumi token "aws:auditmanager/organizationAdminAccountRegistration:OrganizationAdminAccountRegistration" is mapped to TF provider resource "aws_auditmanager_organization_admin_account_registration", but no such resource found. The mapping will be ignored in the generated provider

(it was not just ignored; it stopped the build in its tracks)

I removed the resource definitions and reran make tfgen and it was happy.

Notably, the new data source added to the mapping was not mentioned as a problem. When I removed its definition from resources.go and reran make tfgen, it still completed -- it doesn't care whether it's there or not, apparently.

@mikhailshilkov mikhailshilkov added the kind/bug Some behavior is incorrect or out of spec label Feb 27, 2023
@mikhailshilkov mikhailshilkov added the resolution/fixed This issue was fixed label Nov 15, 2023
@mikhailshilkov mikhailshilkov self-assigned this Nov 15, 2023
@mikhailshilkov
Copy link
Member

I'm pretty sure this has been fixed with out tooling advances, closing as done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

2 participants