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

Fail build on missing data sources, like for resources #718

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/tfgen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1218,8 +1218,8 @@ func (g *Generator) gatherDataSources() (moduleMap, error) {
}
modules := make(moduleMap)

failBuildOnMissingMapError := isTruthy(os.Getenv("PULUMI_MISSING_MAPPING_ERROR")) ||
isTruthy(os.Getenv("PULUMI_PROVIDER_MAP_ERROR"))
skipFailBuildOnMissingMapError := isTruthy(os.Getenv("PULUMI_SKIP_MISSING_MAPPING_ERROR")) || isTruthy(os.Getenv(
"PULUMI_SKIP_PROVIDER_MAP_ERROR"))
failBuildOnExtraMapError := isTruthy(os.Getenv("PULUMI_EXTRA_MAPPING_ERROR"))

// let's keep a list of TF mapping errors that we can present to the user
Expand All @@ -1232,11 +1232,11 @@ func (g *Generator) gatherDataSources() (moduleMap, error) {
dsinfo := g.info.DataSources[ds]
if dsinfo == nil {
if ignoreMappingError(g.info.IgnoreMappings, ds) {
g.debug("TF data source %q not found in provider map", ds)
g.debug("TF data source %q not found in provider map but ignored", ds)
continue
}

if failBuildOnMissingMapError {
if !skipFailBuildOnMissingMapError {
dataSourceMappingErrors = multierror.Append(dataSourceMappingErrors,
fmt.Errorf("TF data source %q not mapped to the Pulumi provider", ds))
} else {
Expand Down