Summary
While auditing the AWS Get Started tutorial (content/docs/iac/get-started/aws/) I found three concrete code defects that would trip up a reader following along in Go or Java.
1. Go: RegisterResourceOutputs called on the wrong resource
In create-component.md, the final componentized NewAwsS3Website function calls:
ctx.RegisterResourceOutputs(website, pulumi.Map{"url": self.Url}) // Signal component completion.
website is the child s3.BucketWebsiteConfiguration resource, not the component (self). Every other language variant in the same section correctly registers outputs against the component instance (TypeScript's this.registerOutputs(...), Python's self.register_outputs(...), C#'s this.RegisterOutputs(...), Java's this.registerOutputs(...)). Passing a child resource here associates the outputs metadata with the wrong resource. It should be:
ctx.RegisterResourceOutputs(self, pulumi.Map{"url": self.Url}) // Signal component completion.
2. Java: skeleton component snippet does not compile
Earlier in the same file, under "Define a new component," the skeleton Java snippet has:
public class AwsS3WebsiteArgs {
public String[] files;
...
}
public class AwsS3Website extends ComponentResource {
public Output<String> url;
public AwsS3Website(String name, AwsS3WebsiteArgs args, ComponentResourceOptions opts) {
super("quickstart:index:AwsS3Website", name, args, opts);
...
this.registerOutputs(Map.of());
}
}
This does not compile: AwsS3WebsiteArgs does not extend ResourceArgs, yet it's passed to the ComponentResource constructor overload that requires a ResourceArgs-typed third argument; Output<String> is used without importing com.pulumi.core.Output; and Map.of() is used without importing java.util.Map. The corrected snippet later in the same file (under "Refactor your code into the component") does have all three, confirming this is a simple omission in the skeleton rather than an intentional simplification.
3. Java: resource logical names inconsistent with every other language
In the componentized Java example (also in create-component.md), two resources use camelCase logical names:
var ownershipControls = new BucketOwnershipControls("ownershipControls", ...)
var publicAccessBlock = new BucketPublicAccessBlock("publicAccessBlock", ...)
Every other language variant (TypeScript, Python, Go, C#, YAML/HCL) uses kebab-case ("ownership-controls", "public-access-block") for the identical resources, and the shared pulumi up output sample shown for all languages in this section shows the kebab-case names. A Java reader who copies the shown code will see different resource names in their own CLI output than what the tutorial's shared sample shows.
Where
All three are in content/docs/iac/get-started/aws/create-component.md.
Suggested fix
- Change
ctx.RegisterResourceOutputs(website, ...) to ctx.RegisterResourceOutputs(self, ...).
- Add
extends ResourceArgs to the skeleton AwsS3WebsiteArgs class and add the missing com.pulumi.core.Output and java.util.Map imports to that skeleton snippet.
- Rename the two Java resource logical names to
"ownership-controls" and "public-access-block" to match the other language variants.
Summary
While auditing the AWS Get Started tutorial (
content/docs/iac/get-started/aws/) I found three concrete code defects that would trip up a reader following along in Go or Java.1. Go:
RegisterResourceOutputscalled on the wrong resourceIn
create-component.md, the final componentizedNewAwsS3Websitefunction calls:websiteis the childs3.BucketWebsiteConfigurationresource, not the component (self). Every other language variant in the same section correctly registers outputs against the component instance (TypeScript'sthis.registerOutputs(...), Python'sself.register_outputs(...), C#'sthis.RegisterOutputs(...), Java'sthis.registerOutputs(...)). Passing a child resource here associates the outputs metadata with the wrong resource. It should be:2. Java: skeleton component snippet does not compile
Earlier in the same file, under "Define a new component," the skeleton Java snippet has:
This does not compile:
AwsS3WebsiteArgsdoes not extendResourceArgs, yet it's passed to theComponentResourceconstructor overload that requires aResourceArgs-typed third argument;Output<String>is used without importingcom.pulumi.core.Output; andMap.of()is used without importingjava.util.Map. The corrected snippet later in the same file (under "Refactor your code into the component") does have all three, confirming this is a simple omission in the skeleton rather than an intentional simplification.3. Java: resource logical names inconsistent with every other language
In the componentized Java example (also in
create-component.md), two resources use camelCase logical names:Every other language variant (TypeScript, Python, Go, C#, YAML/HCL) uses kebab-case (
"ownership-controls","public-access-block") for the identical resources, and the sharedpulumi upoutput sample shown for all languages in this section shows the kebab-case names. A Java reader who copies the shown code will see different resource names in their own CLI output than what the tutorial's shared sample shows.Where
All three are in
content/docs/iac/get-started/aws/create-component.md.Suggested fix
ctx.RegisterResourceOutputs(website, ...)toctx.RegisterResourceOutputs(self, ...).extends ResourceArgsto the skeletonAwsS3WebsiteArgsclass and add the missingcom.pulumi.core.Outputandjava.util.Mapimports to that skeleton snippet."ownership-controls"and"public-access-block"to match the other language variants.