@@ -29,11 +29,13 @@ import (
2929 "github.com/mitchellh/go-homedir"
3030 "github.com/pulumi/pulumi-aws/provider/v5/pkg/version"
3131 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
32+ "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/x"
3233 shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
3334 shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
3435 "github.com/pulumi/pulumi/pkg/v3/codegen/schema"
3536 "github.com/pulumi/pulumi/sdk/v3/go/common/resource"
3637 "github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
38+ "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
3739)
3840
3941// all of the AWS token components used below.
@@ -50,7 +52,6 @@ const (
5052 amplifyMod = "Amplify" // Amplify
5153 appFlowMod = "AppFlow" // AppFlow
5254 appConfigMod = "AppConfig" // AppConfig
53- appIntegrationsMod = "AppIntegrations" // AppIntegrations
5455 applicationInsightsMod = "ApplicationInsights" // Cloudwatch Application Insights
5556 appStreamMod = "AppStream" // AppStream
5657 appsyncMod = "AppSync" // AppSync
@@ -232,6 +233,198 @@ const (
232233 legacyElbv2Mod = "ElasticLoadBalancingV2"
233234)
234235
236+ var moduleMap = map [string ]string {
237+ // Ignored: ec2Mod. The ec2Mod includes tokens from:
238+ // - "aws_eip"
239+ // - "aws_flow_log"
240+ // - "aws_ami_copy"
241+ //
242+ // It's not clear what the auto-token should be.
243+
244+ // We don't map legacy modules
245+
246+ "acm" : acmMod ,
247+ "acmpca" : acmpcaMod ,
248+ "account" : accountMod ,
249+ "accessanalyzer" : accessAnalyzerMod ,
250+ "prometheus" : ampMod ,
251+ "amplify" : amplifyMod ,
252+ "appflow" : appFlowMod ,
253+ "appconfig" : appConfigMod ,
254+ "applicationinsights" : applicationInsightsMod ,
255+ "appstream" : appStreamMod ,
256+ "appsync" : appsyncMod ,
257+ "appmesh" : appmeshMod ,
258+ "api_gateway" : apigatewayMod ,
259+ "apigatewayv2" : apigatewayv2Mod ,
260+ "appautoscaling" : appautoscalingMod ,
261+ "apprunner" : appRunnerMod ,
262+ "athena" : athenaMod ,
263+ "autoscaling" : autoscalingMod ,
264+ "autoscalingplans" : autoscalingPlansMod ,
265+ "backup" : backupMod ,
266+ "batch" : batchMod ,
267+ "budgets" : budgetsMod ,
268+ "chime" : chimeMod ,
269+ "chimesdkmediapipelines" : chimeSDKMediaPipelinesMod ,
270+ "cloud9" : cloud9Mod ,
271+ "cloudcontrolapi" : cloudControlMod ,
272+ "cloudformation" : cloudformationMod ,
273+ "cloudhsm_v2" : cloudhsmv2Mod ,
274+ "cloudfront" : cloudfrontMod ,
275+ "cloudsearch" : cloudsearchMod ,
276+ "cloudtrail" : cloudtrailMod ,
277+ "cloudwatch" : cloudwatchMod ,
278+ "codeartifact" : codeartifactMod ,
279+ "codebuild" : codebuildMod ,
280+ "codecommit" : codecommitMod ,
281+ "codedeploy" : codedeployMod ,
282+ "codegurureviewer" : codeguruReviewerMod ,
283+ "codepipeline" : codepipelineMod ,
284+ "codestarconnections" : codestarConnectionsMod ,
285+ "codestarnotifications" : codestarNotificationsMod ,
286+ "cognito" : cognitoMod ,
287+ "comprehend" : comprehendMod ,
288+ "connect" : connectMod ,
289+ "controltower" : controlTowerMod ,
290+ "ce" : costExplorerMod ,
291+ "cur" : curMod ,
292+ "config" : cfgMod ,
293+ "dataexchange" : dataexchangeMod ,
294+ "datapipeline" : datapipelineMod ,
295+ "datasync" : datasyncMod ,
296+ "dax" : daxMod ,
297+ "dlm" : dlmMod ,
298+ "detective" : detectiveMod ,
299+ "devicefarm" : devicefarmMod ,
300+ "directory_service" : directoryserviceMod ,
301+ "docdb" : docdbMod ,
302+ "dynamodb" : dynamodbMod ,
303+ "dx" : dxMod ,
304+ "dms" : dmsMod ,
305+ "ebs" : ebsMod ,
306+ "ec2_client_vpn" : ec2ClientVpnMod ,
307+ "ec2_transit_gateway" : ec2TransitGatewayMod ,
308+ "ecr" : ecrMod ,
309+ "ecrpublic" : ecrPublicMod ,
310+ "ecs" : ecsMod ,
311+ "efs" : efsMod ,
312+ "eks" : eksMod ,
313+ "elasticache" : elasticacheMod ,
314+ "elastic_beanstalk" : elasticbeanstalkMod ,
315+ "elasticsearch" : elasticsearchMod ,
316+ "elastictranscoder" : elastictranscoderMod ,
317+ "elb" : elbMod ,
318+ "evidently" : evidentlyMod ,
319+ "alb" : albMod ,
320+ "lb" : lbMod ,
321+ "emr" : emrMod ,
322+ "emrcontainers" : emrContainersMod ,
323+ "emrserverless" : emrServerlessMod ,
324+ "fis" : fisMod ,
325+ "fms" : fmsMod ,
326+ "fsx" : fsxMod ,
327+ "gamelift" : gameliftMod ,
328+ "glacier" : glacierMod ,
329+ "globalaccelerator" : globalacceleratorMod ,
330+ "glue" : glueMod ,
331+ "grafana" : grafanaMod ,
332+ "guardduty" : guarddutyMod ,
333+ "iam" : iamMod ,
334+ "identitystore" : identityStoreMod ,
335+ "imagebuilder" : imageBuilderMod ,
336+ "inspector" : inspectorMod ,
337+ "inspector2" : inspector2Mod ,
338+ "iot" : iotMod ,
339+ "ivs" : ivsMod ,
340+ "ivschat" : ivsChatMod ,
341+ "kendra" : kendraMod ,
342+ "keyspaces" : keyspacesMod ,
343+ "kinesis" : kinesisMod ,
344+ "kinesisanalyticsv2" : kinesisAnalyticsMod ,
345+ "kms" : kmsMod ,
346+ "lakeformation" : lakeFormationMod ,
347+ "lambda" : lambdaMod ,
348+ "lex" : lexMod ,
349+ "licensemanager" : licensemanagerMod ,
350+ "lightsail" : lightsailMod ,
351+ "location" : locationMod ,
352+ "macie" : macieMod ,
353+ "macie2" : macie2Mod ,
354+ "media_convert" : mediaconvertMod ,
355+ "medialive" : medialiveMod ,
356+ "media_package" : mediapackageMod ,
357+ "media_store" : mediastoreMod ,
358+ "memorydb" : memoryDbMod ,
359+ "mq" : mqMod ,
360+ "msk" : mskMod ,
361+ "mskconnect" : mskConnectMod ,
362+ "mwaa" : mwaaMod ,
363+ "neptune" : neptuneMod ,
364+ "networkfirewall" : networkFirewallMod ,
365+ "networkmanager" : networkManagerMod ,
366+ "oam" : oamMod ,
367+ "opensearch" : opensearchMod ,
368+ "opsworks" : opsworksMod ,
369+ "organizations" : organizationsMod ,
370+ "outposts" : outpostsMod ,
371+ "pinpoint" : pinpointMod ,
372+ "pipes" : pipesMod ,
373+ "pricing" : pricingMod ,
374+ "qldb" : qldbMod ,
375+ "quicksight" : quicksightMod ,
376+ "ram" : ramMod ,
377+ "rbin" : rbinMod ,
378+ "rds" : rdsMod ,
379+ "redshift" : redshiftMod ,
380+ "redshiftdata" : redshiftDataMod ,
381+ "redshiftserverless" : redshiftServerlessMod ,
382+ "resourcegroups" : resourcegroupsMod ,
383+ "resourcegroupstaggingapi" : resourcegroupsTaggingApiMod ,
384+ "rolesanywhere" : rolesAnywhereMod ,
385+ "route53" : route53Mod ,
386+ "route53recoverycontrolconfig" : route53RecoveryControlMod ,
387+ "route53recoveryreadiness" : route53RecoveryReadinessMod ,
388+ "route53domains" : route53DomainsMod ,
389+ "rum" : rumMod ,
390+ "sagemaker" : sagemakerMod ,
391+ "scheduler" : schedulerMod ,
392+ "schemas" : schemasMod ,
393+ "securityhub" : securityhubMod ,
394+ "serverlessapplicationrepository" : serverlessRepositoryMod ,
395+ "ses" : sesMod ,
396+ "sesv2" : sesV2Mod ,
397+ "signer" : signerMod ,
398+ "s3" : s3Mod ,
399+ "s3control" : s3ControlMod ,
400+ "s3outposts" : s3OutpostsMod ,
401+ "ssm" : ssmMod ,
402+ "ssmincidents" : ssmIncidentsMod ,
403+ "secretsmanager" : secretsmanagerMod ,
404+ "servicecatalog" : servicecatalogMod ,
405+ "service_discovery" : servicediscoveryMod ,
406+ "servicequotas" : servicequotasMod ,
407+ "sfn" : sfnMod ,
408+ "shield" : shieldMod ,
409+ "simpledb" : simpledbMod ,
410+ "sns" : snsMod ,
411+ "sqs" : sqsMod ,
412+ "ssoadmin" : ssoAdminMod ,
413+ "storagegateway" : storagegatewayMod ,
414+ "swf" : swfMod ,
415+ "synthetics" : syntheticsMod ,
416+ "timestreamwrite" : timestreamWriteMod ,
417+ "transcribe" : transcribeMod ,
418+ "transfer" : transferMod ,
419+ "vpclattice" : vpclatticeMod ,
420+ "waf" : wafMod ,
421+ "wafv2" : wafV2Mod ,
422+ "wafregional" : wafregionalMod ,
423+ "worklink" : worklinkMod ,
424+ "workspaces" : workspacesMod ,
425+ "xray" : xrayMod ,
426+ }
427+
235428var namespaceMap = map [string ]string {
236429 "aws" : "Aws" ,
237430}
@@ -480,7 +673,6 @@ func Provider() tfbridge.ProviderInfo {
480673 PreConfigureCallback : preConfigureCallback ,
481674 Resources : map [string ]* tfbridge.ResourceInfo {
482675 // AWS Certificate Manager
483- "aws_acm_certificate" : {Tok : awsResource (acmMod , "Certificate" )},
484676 "aws_acm_certificate_validation" : {
485677 Tok : awsResource (acmMod , "CertificateValidation" ),
486678 Docs : & tfbridge.DocInfo {
@@ -497,9 +689,6 @@ func Provider() tfbridge.ProviderInfo {
497689 },
498690 },
499691 },
500- "aws_acmpca_certificate_authority_certificate" : {
501- Tok : awsResource (acmpcaMod , "CertificateAuthorityCertificate" ),
502- },
503692 "aws_acmpca_policy" : {
504693 Tok : awsResource (acmpcaMod , "Policy" ),
505694 Fields : map [string ]* tfbridge.SchemaInfo {
@@ -508,7 +697,6 @@ func Provider() tfbridge.ProviderInfo {
508697 },
509698 },
510699 },
511- "aws_acmpca_permission" : {Tok : awsResource (acmpcaMod , "Permission" )},
512700 // Account
513701 "aws_account_alternate_contact" : {Tok : awsResource (accountMod , "AlternativeContact" )},
514702 // AppSync
@@ -553,8 +741,6 @@ func Provider() tfbridge.ProviderInfo {
553741 },
554742 },
555743 },
556- "aws_appsync_resolver" : {Tok : awsResource (appsyncMod , "Resolver" )},
557- "aws_appsync_api_cache" : {Tok : awsResource (appsyncMod , "ApiCache" )},
558744 "aws_appsync_domain_name" : {
559745 Tok : awsResource (appsyncMod , "DomainName" ),
560746 Fields : map [string ]* tfbridge.SchemaInfo {
@@ -962,7 +1148,6 @@ func Provider() tfbridge.ProviderInfo {
9621148 },
9631149 },
9641150 },
965- "aws_budgets_budget_action" : {Tok : awsResource (budgetsMod , "BudgetAction" )},
9661151 // Chime
9671152 "aws_chime_voice_connector" : {Tok : awsResource (chimeMod , "VoiceConnector" )},
9681153 "aws_chime_voice_connector_group" : {Tok : awsResource (chimeMod , "VoiceConnectorGroup" )},
@@ -1003,8 +1188,6 @@ func Provider() tfbridge.ProviderInfo {
10031188 },
10041189 },
10051190 // CloudFront
1006- "aws_cloudfront_distribution" : {Tok : awsResource (cloudfrontMod , "Distribution" )},
1007- "aws_cloudfront_public_key" : {Tok : awsResource (cloudfrontMod , "PublicKey" )},
10081191 "aws_cloudfront_origin_access_identity" : {Tok : awsResource (cloudfrontMod , "OriginAccessIdentity" )},
10091192 "aws_cloudfront_origin_request_policy" : {Tok : awsResource (cloudfrontMod , "OriginRequestPolicy" )},
10101193 "aws_cloudfront_cache_policy" : {Tok : awsResource (cloudfrontMod , "CachePolicy" )},
@@ -6796,6 +6979,12 @@ func Provider() tfbridge.ProviderInfo {
67966979 prov .RenameDataSource ("aws_canonical_user_id" , awsDataSource (awsMod , "getCanonicalUserId" ),
67976980 awsDataSource (s3Mod , "getCanonicalUserId" ), awsMod , s3Mod , nil )
67986981
6982+ err := x .ComputeDefaults (& prov , x .TokensMappedModules ("aws_" , "" , moduleMap ,
6983+ func (mod , name string ) (string , error ) {
6984+ return awsResource (mod , name ).String (), nil
6985+ }))
6986+ contract .AssertNoErrorf (err , "failed to apply default token mappings" )
6987+
67996988 prov .SetAutonaming (255 , "-" )
68006989
68016990 // Add a CSharp-specific override for aws_s3_bucket.bucket.
0 commit comments