diff --git a/provider/provider_yaml_test.go b/provider/provider_yaml_test.go index 68b47717a4..37eff12d04 100644 --- a/provider/provider_yaml_test.go +++ b/provider/provider_yaml_test.go @@ -219,12 +219,12 @@ func TestGlobalProjectNoProjectWarning(t *testing.T) { test := pulumitest.NewPulumiTest(t, "test-programs/project-bucket", opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin"))) - test.SetConfig(t, "gcp:project", noProjectVar) + test.SetConfig(t, "gcp:project", noProjectMarker) test.SetConfig(t, "gcpProj", proj) res := test.Up(t) require.Contains( t, res.StdOut, - noProjectVar, + noProjectMarker, ) } diff --git a/provider/resources.go b/provider/resources.go index 7d48eff39c..72de50ca27 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -48,128 +48,129 @@ const ( gcpActiveDirectory = "ActiveDirectory" // Active Directory resources gcpAlloydb = "Alloydb" // Alloydb resources // nolint:revive - gcpApiGateway = "ApiGateway" // ApiGateway resources - gcpApigee = "Apigee" // Apigee resources - gcpAppEngine = "AppEngine" // AppEngine resources - gcpApplicationIntegration = "ApplicationIntegration" // Application Integration - gcpArtifactRegistry = "ArtifactRegistry" // ArtifactRegistry resources - gcpAssuredWorkloads = "AssuredWorkloads" // AssuredWorkloads resources - gcpBackupDR = "BackupDisasterRecovery" // Backup and Disaster Recovery resources - gcpBeyondcorp = "Beyondcorp" // Beyondcorp resources - gcpBigLake = "BigLake" // BigLake resources - gcpBigQuery = "BigQuery" // BigQuery resources - gcpBigQueryAnalyticsHub = "BigQueryAnalyticsHub" // BigQuery Analytics Hub resources - gcpBigQueryDataPolicy = "BigQueryDataPolicy" // BigQuery Data Policy resources - gcpBigTable = "BigTable" // BitTable resources - gcpBilling = "Billing" // Billing resources - gcpBinaryAuthorization = "BinaryAuthorization" // Binary Authorization resources - gcpBlockchainNodeEngine = "BlockchainNodeEngine" // Blockchain Node Engine resources - gcpCertificateAuthority = "CertificateAuthority" // CertificateAuthority resources - gcpCertificateManager = "CertificateManager" // CertificateManager resources - gcpCloudAsset = "CloudAsset" // CloudAsset resources - gcpCloudBuild = "CloudBuild" // CloudBuild resources - gcpCloudBuildV2 = "CloudBuildV2" // CloudBuild (2nd Gen) resources - gcpCloudDeploy = "CloudDeploy" // CloudDeploy resources - gcpCloudFunctions = "CloudFunctions" // CloudFunction resources - gcpCloudFunctionsV2 = "CloudFunctionsV2" // CloudFunction (2nd Gen) resources - gcpCloudIdentity = "CloudIdentity" // CloudIdentity resources - gcpCloudIDs = "CloudIds" // CloudIds resources - gcpCloudRun = "CloudRun" // CloudRun resources - gcpCloudRunV2 = "CloudRunV2" // CloudRun (2nd Gen) resources - gcpCloudScheduler = "CloudScheduler" // Cloud Scheduler resources - gcpCloudTasks = "CloudTasks" // Cloud Tasks resources - gcpComposer = "Composer" // Cloud Composer resources - gcpCompute = "Compute" // Compute resources - gcpContainerAnalysis = "ContainerAnalysis" // Container Analysis resources - gcpDNS = "Dns" // DNS resources - gcpDeveloperConnect = "DeveloperConnect" // Developer Connect - gcpDataCatalog = "DataCatalog" // Data Catalog resources - gcpDataFlow = "Dataflow" // DataFlow resources - gcpDataFusion = "DataFusion" // DataFusion resources - gcpDataLoss = "DataLoss" // DataLoss resources - gcpDataPlex = "DataPlex" // DataPlex - gcpDataProc = "Dataproc" // DataProc resources - gcpDatabaseMigrationService = "DatabaseMigrationService" // Database Migration Service resources - gcpDataform = "Dataform" // Dataform resources - gcpDatastore = "Datastore" // Datastore resources - gcpDatastream = "Datastream" // Datastream resources - gcpDeploymentManager = "DeploymentManager" // DeploymentManager resources - gcpDiagflow = "Diagflow" // Diagflow resources - gcpDiscoveryEngine = "DiscoveryEngine" // Discovery Engine - gcpEdgeNetwork = "EdgeNetwork" // Distributed Cloud Edge Network resources - gcpEdgecontainer = "EdgeContainer" // Cloud Edge Container resources - gcpEndPoints = "Endpoints" // End Point resources - gcpEssentialContacts = "EssentialContacts" // Essential Contacts resources - gcpEventarc = "Eventarc" // Eventarc - gcpFilestore = "Filestore" // Filestore resources - gcpFirebase = "Firebase" // Firebase resources - gcpFirebaserules = "Firebaserules" // FirebaseRules resources - gcpFirestore = "Firestore" // Firestore resources - gcpFolder = "Folder" // Folder resources - gcpGameServices = "GameServices" // Game Services resources - gcpGkeBackup = "GkeBackup" // Gke Backup resources - gcpGkeHub = "GkeHub" // Gke Hub resources - gcpGkeOnPrem = "GkeOnPrem" // Gke On Prem resources - gcpHealthcare = "Healthcare" // Healthcare resources - gcpIAM = "Iam" // IAM resources - gcpIAP = "Iap" // IAP resources - gcpIdentityPlatform = "IdentityPlatform" // IdentityPlatform resources - gcpIntegrationConnectors = "IntegrationConnectors" // Integration Connectors resources - gcpIot = "Iot" // Iot resources - gcpKMS = "Kms" // KMS resources - gcpKubernetes = "Container" // Kubernetes Engine resources - gcpLogging = "Logging" // Logging resources - gcpLooker = "Looker" // Looker resources - gcpMachingLearning = "ML" // Machine Learning - gcpManagedKafka = "ManagedKafka" // Managed Kafka - gcpMemcache = "Memcache" // Memcache resources - gcpMemorystore = "MemoryStore" // Memory Store - gcpMigrationCenter = "MigrationCenter" // Migration Center - gcpMonitoring = "Monitoring" // Monitoring resources - gcpNetapp = "Netapp" // Netapp - gcpNetworkConnectivity = "NetworkConnectivity" // Network Connectivity resources - gcpNetworkManagement = "NetworkManagement" // Network Management resources - gcpNetworkSecurity = "NetworkSecurity" // Network Security resources - gcpNetworkServices = "NetworkServices" // Network Services resources - gcpNotebooks = "Notebooks" // Notebooks resources - gcpOracleDatabase = "OracleDatabase" // Oracle Database - gcpOrgPolicy = "OrgPolicy" // Org Policy - gcpOrganization = "Organizations" // Organization resources - gcpOsConfig = "OsConfig" // OsConfig resources - gcpOsLogin = "OsLogin" // OsLogin resources - gcpParallelStore = "ParallelStore" // ParallelStore resources - gcpPrivilegedAccessManager = "PrivilegedAccessManager" // Privileged Access Manager - gcpProject = "Projects" // Project resources - gcpPubSub = "PubSub" // PubSub resources - gcpRecaptcha = "Recaptcha" // Recaptcha resources - gcpRedis = "Redis" // Redis resources - gcpResourceManager = "ResourceManager" // Resource Manager resources - gcpRuntimeConfig = "RuntimeConfig" // Runtime Config resources - gcpSQL = "Sql" // SQL resources - gcpSecretManager = "SecretManager" // Secret Manager resources - gcpSecureSourceManager = "SecureSourceManager" // Secure Source Manager - gcpSecurityCenter = "SecurityCenter" // Security Center - gcpSecurityPosture = "SecurityPosture" // Security Posture - gcpServiceAccount = "ServiceAccount" // Service Account resources - gcpServiceDirectory = "ServiceDirectory" // Service Directory resources - gcpServiceNetworking = "ServiceNetworking" // Service Networking resources - gcpServiceUsage = "ServiceUsage" // Service Usage resources - gcpSiteVerification = "SiteVerification" // Site Verification - gcpSourceRepo = "SourceRepo" // Source Repo resources - gcpSpanner = "Spanner" // Spanner Resources - gcpStorage = "Storage" // Storage resources - gcpTPU = "Tpu" // Tensor Processing Units - gcpTags = "Tags" // Tags - gcpTranscoder = "Transcoder" // Transcoder - gcpVMwareEngine = "VMwareEngine" // VMWare Engine - gcpVertex = "Vertex" // Vertex - gcpVpcAccess = "VpcAccess" // VPC Access - gcpWorkbench = "Workbench" // Workbench - gcpWorkflows = "Workflows" // Workflows - gcpWorkstations = "Workstations" // Workstations + gcpApiGateway = "ApiGateway" // ApiGateway resources + gcpApigee = "Apigee" // Apigee resources + gcpAppEngine = "AppEngine" // AppEngine resources + gcpApplicationIntegration = "ApplicationIntegration" // Application Integration + gcpArtifactRegistry = "ArtifactRegistry" // ArtifactRegistry resources + gcpAssuredWorkloads = "AssuredWorkloads" // AssuredWorkloads resources + gcpBackupDR = "BackupDisasterRecovery" // Backup and Disaster Recovery resources + gcpBeyondcorp = "Beyondcorp" // Beyondcorp resources + gcpBigLake = "BigLake" // BigLake resources + gcpBigQuery = "BigQuery" // BigQuery resources + gcpBigQueryAnalyticsHub = "BigQueryAnalyticsHub" // BigQuery Analytics Hub resources + gcpBigQueryDataPolicy = "BigQueryDataPolicy" // BigQuery Data Policy resources + gcpBigTable = "BigTable" // BitTable resources + gcpBilling = "Billing" // Billing resources + gcpBinaryAuthorization = "BinaryAuthorization" // Binary Authorization resources + gcpBlockchainNodeEngine = "BlockchainNodeEngine" // Blockchain Node Engine resources + gcpCertificateAuthority = "CertificateAuthority" // CertificateAuthority resources + gcpCertificateManager = "CertificateManager" // CertificateManager resources + gcpCloudAsset = "CloudAsset" // CloudAsset resources + gcpCloudBuild = "CloudBuild" // CloudBuild resources + gcpCloudBuildV2 = "CloudBuildV2" // CloudBuild (2nd Gen) resources + gcpCloudDeploy = "CloudDeploy" // CloudDeploy resources + gcpCloudFunctions = "CloudFunctions" // CloudFunction resources + gcpCloudFunctionsV2 = "CloudFunctionsV2" // CloudFunction (2nd Gen) resources + gcpCloudIdentity = "CloudIdentity" // CloudIdentity resources + gcpCloudIDs = "CloudIds" // CloudIds resources + gcpCloudRun = "CloudRun" // CloudRun resources + gcpCloudRunV2 = "CloudRunV2" // CloudRun (2nd Gen) resources + gcpCloudScheduler = "CloudScheduler" // Cloud Scheduler resources + gcpCloudTasks = "CloudTasks" // Cloud Tasks resources + gcpComposer = "Composer" // Cloud Composer resources + gcpCompute = "Compute" // Compute resources + gcpContainerAnalysis = "ContainerAnalysis" // Container Analysis resources + gcpDNS = "Dns" // DNS resources + gcpDeveloperConnect = "DeveloperConnect" // Developer Connect + gcpDataCatalog = "DataCatalog" // Data Catalog resources + gcpDataFlow = "Dataflow" // DataFlow resources + gcpDataFusion = "DataFusion" // DataFusion resources + gcpDataLoss = "DataLoss" // DataLoss resources + gcpDataPlex = "DataPlex" // DataPlex + gcpDataProc = "Dataproc" // DataProc resources + gcpDatabaseMigrationService = "DatabaseMigrationService" // Database Migration Service resources + gcpDataform = "Dataform" // Dataform resources + gcpDatastore = "Datastore" // Datastore resources + gcpDatastream = "Datastream" // Datastream resources + gcpDeploymentManager = "DeploymentManager" // DeploymentManager resources + gcpDiagflow = "Diagflow" // Diagflow resources + gcpDiscoveryEngine = "DiscoveryEngine" // Discovery Engine + gcpEdgeNetwork = "EdgeNetwork" // Distributed Cloud Edge Network resources + gcpEdgecontainer = "EdgeContainer" // Cloud Edge Container resources + gcpEndPoints = "Endpoints" // End Point resources + gcpEssentialContacts = "EssentialContacts" // Essential Contacts resources + gcpEventarc = "Eventarc" // Eventarc + gcpFilestore = "Filestore" // Filestore resources + gcpFirebase = "Firebase" // Firebase resources + gcpFirebaserules = "Firebaserules" // FirebaseRules resources + gcpFirestore = "Firestore" // Firestore resources + gcpFolder = "Folder" // Folder resources + gcpGameServices = "GameServices" // Game Services resources + gcpGkeBackup = "GkeBackup" // Gke Backup resources + gcpGkeHub = "GkeHub" // Gke Hub resources + gcpGkeOnPrem = "GkeOnPrem" // Gke On Prem resources + gcpHealthcare = "Healthcare" // Healthcare resources + gcpIAM = "Iam" // IAM resources + gcpIAP = "Iap" // IAP resources + gcpIdentityPlatform = "IdentityPlatform" // IdentityPlatform resources + gcpIntegrationConnectors = "IntegrationConnectors" // Integration Connectors resources + gcpIot = "Iot" // Iot resources + gcpKMS = "Kms" // KMS resources + gcpKubernetes = "Container" // Kubernetes Engine resources + gcpLogging = "Logging" // Logging resources + gcpLooker = "Looker" // Looker resources + gcpMachingLearning = "ML" // Machine Learning + gcpManagedKafka = "ManagedKafka" // Managed Kafka + gcpMemcache = "Memcache" // Memcache resources + gcpMemorystore = "MemoryStore" // Memory Store + gcpMigrationCenter = "MigrationCenter" // Migration Center + gcpMonitoring = "Monitoring" // Monitoring resources + gcpNetapp = "Netapp" // Netapp + gcpNetworkConnectivity = "NetworkConnectivity" // Network Connectivity resources + gcpNetworkManagement = "NetworkManagement" // Network Management resources + gcpNetworkSecurity = "NetworkSecurity" // Network Security resources + gcpNetworkServices = "NetworkServices" // Network Services resources + gcpNotebooks = "Notebooks" // Notebooks resources + gcpOracleDatabase = "OracleDatabase" // Oracle Database + gcpOrgPolicy = "OrgPolicy" // Org Policy + gcpOrganization = "Organizations" // Organization resources + gcpOsConfig = "OsConfig" // OsConfig resources + gcpOsLogin = "OsLogin" // OsLogin resources + gcpParallelStore = "ParallelStore" // ParallelStore resources + gcpPrivilegedAccessManager = "PrivilegedAccessManager" // Privileged Access Manager + gcpProject = "Projects" // Project resources + gcpPubSub = "PubSub" // PubSub resources + gcpRecaptcha = "Recaptcha" // Recaptcha resources + gcpRedis = "Redis" // Redis resources + gcpResourceManager = "ResourceManager" // Resource Manager resources + gcpRuntimeConfig = "RuntimeConfig" // Runtime Config resources + gcpSQL = "Sql" // SQL resources + gcpSecretManager = "SecretManager" // Secret Manager resources + gcpSecureSourceManager = "SecureSourceManager" // Secure Source Manager + gcpSecurityCenter = "SecurityCenter" // Security Center + gcpSecurityPosture = "SecurityPosture" // Security Posture + gcpServiceAccount = "ServiceAccount" // Service Account resources + gcpServiceDirectory = "ServiceDirectory" // Service Directory resources + gcpServiceNetworking = "ServiceNetworking" // Service Networking resources + gcpServiceUsage = "ServiceUsage" // Service Usage resources + gcpSiteVerification = "SiteVerification" // Site Verification + gcpSourceRepo = "SourceRepo" // Source Repo resources + gcpSpanner = "Spanner" // Spanner Resources + gcpStorage = "Storage" // Storage resources + gcpTPU = "Tpu" // Tensor Processing Units + gcpTags = "Tags" // Tags + gcpTranscoder = "Transcoder" // Transcoder + gcpVMwareEngine = "VMwareEngine" // VMWare Engine + gcpVertex = "Vertex" // Vertex + gcpVpcAccess = "VpcAccess" // VPC Access + gcpWorkbench = "Workbench" // Workbench + gcpWorkflows = "Workflows" // Workflows + gcpWorkstations = "Workstations" // Workstations ) -// When `gcp:project` is set to noProjectMarkerValue, we don't warn that a global project is missing and we don't try to validate the project. +// When `gcp:project` is set to noProjectMarker, we don't warn that a global project is missing +// and we don't try to validate the project. const noProjectMarker = "DisableGlobalProjectWarning" var moduleMapping = map[string]string{ @@ -431,7 +432,7 @@ func preConfigureCallbackWithLogger(credentialsValidationRun *atomic.Bool, gcpCl } // validate the gcloud config - if config.Project != noProjectVar { + if config.Project != noProjectMarker { err := config.LoadAndValidate(ctx) if err != nil { return fmt.Errorf(noCredentialsErr, err) @@ -442,7 +443,7 @@ func preConfigureCallbackWithLogger(credentialsValidationRun *atomic.Bool, gcpCl vars, "skipRegionValidation", []string{"PULUMI_GCP_SKIP_REGION_VALIDATION"}, ) - if !skipRegionValidation && config.Region != "" && config.Project != "" && config.Project != noProjectVar { + if !skipRegionValidation && config.Region != "" && config.Project != "" && config.Project != noProjectMarker { regionList, err := getRegionsList(ctx, config.Project, gcpClientOpts) if err != nil { logOrPrint(ctx, host, fmt.Sprintf("failed to get regions list for project(%s): %v", config.Project, err))