Skip to content

Support static website Read() from id in addition to state to enable import#4035

Merged
thomas11 merged 1 commit into
masterfrom
tkappler/staticwebsite-import
Mar 18, 2025
Merged

Support static website Read() from id in addition to state to enable import#4035
thomas11 merged 1 commit into
masterfrom
tkappler/staticwebsite-import

Conversation

@thomas11

Copy link
Copy Markdown
Contributor

When importing, there is no state yet and Read is called with only the id. That's enough but the previous code didn't expect that and failed.

Resolves #4028.

@thomas11 thomas11 requested review from a team and danielrbradley March 18, 2025 07:44
@github-actions

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@codecov

codecov Bot commented Mar 18, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 47.36842% with 10 lines in your changes missing coverage. Please review.

Project coverage is 57.85%. Comparing base (fdcf15a) to head (ba98978).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...urces/customresources/custom_storage_azidentity.go 47.36% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4035      +/-   ##
==========================================
- Coverage   57.86%   57.85%   -0.01%     
==========================================
  Files          83       83              
  Lines       13375    13391      +16     
==========================================
+ Hits         7739     7747       +8     
- Misses       5037     5045       +8     
  Partials      599      599              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@danielrbradley danielrbradley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me .. I assume this was only a bug in the azidentity version?

Comment on lines +133 to +135
func (r *staticWebsite_azidentity) newStorageAccountClientForAccount(accName string) (*azblob.Client, error) {
return newStorageAccountClientForAccount(accName, r.env, r.creds)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new method threw me a little when reading the diff being the same name as the thing it calls within. Looks like it's only called in one place, could we just call inner function directly there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern mirrors the existing newStorageAccountClient that also exists twice. I think it makes sense - they do the same thing but the method on the resource needs fewer arguments.

@thomas11

Copy link
Copy Markdown
Contributor Author

This looks okay to me .. I assume this was only a bug in the azidentity version?

It's a bug in both but I don't think we should spend time fixing the autorest code anymore. I'm hoping to remove it soon.

@thomas11 thomas11 force-pushed the tkappler/staticwebsite-import branch from 1d69316 to ba98978 Compare March 18, 2025 11:42
@thomas11 thomas11 enabled auto-merge (squash) March 18, 2025 11:43
@thomas11 thomas11 merged commit 27fbdaf into master Mar 18, 2025
@thomas11 thomas11 deleted the tkappler/staticwebsite-import branch March 18, 2025 12:18
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v2.89.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Importing azure-native:storage:StorageAccountStaticWebsite fails with "accountName" not found in resource state

3 participants