Structuring Terraform code and generating architecture diagrams with nanobanana pro
This is Oniumi (@fat47) from the Service Reliability Group (SRG) of the Media Headquarters.
#SRG(Service Reliability Group) is a group that mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, and contributing to OSS.
This article will explain how to structure Terraform code with Repomix and then create an architecture diagram with Gemini (Nanobana Pro).
I hope this helps in some way.
What is Nanobanana Pro?What is Repomix?Prompt to generate an architecture diagramGenerate images with Gemini CLIConclusion
What is Nanobanana Pro?
Nano Banana Pro (Gemini 3 Pro Image) is an image generation AI model announced by Google on November 20th. It has output accuracy that is incomparable to previous models, and is capable of outputting text without distortion.
What is Repomix?
Repomix is an open source project created by yamadashy, which is a tool that combines an entire repository into a single file that is easy for AI to understand.
In this example, by running Repomix against the repository that manages the Terraform code, all of the Modules and Resources separated into directories within the repository are combined into a single xml file.
Repomix installation
If you run it in the repository directory, it will generate repomix-output.xml in that directory.
Prompt to generate an architecture diagram
Sometimes the image wouldn't be generated when I used Japanese, so I gave instructions in English.
task:Create architecture diagram images using Nanobanana Pro.
background:
- The attachment is a Terraform repository that has been converted to XML using Repomix.
common
- The other directories represent individual services.
Restrictions:
- Clearly visualize the connections between components.
- IAM roles are excludedand reduce complexity.
- Route53 record information is excludeddo.
Provide Gemini with these instructions and the file generated by Repomix (repomix-output.xml).

This time, the following architecture diagram was generated.

Generate images with Gemini CLI
You can also generate images from the CLI instead of the Gemini Web UI.
To generate images from CLI, install gemini-cli-xtensions/nanobanan.
For more information about gemini-cli-extensions, please see here.
install
Set the following environment variables to enable nanobanana pro.
Start gemini and check the extension.
Now we can confirm that the nanobanana extension is enabled.

The nano banana extension has the following commands:
/generate- Generate one or multiple images with style and variation options.
/edit- Edit images.
/restore- Repair and restore images.
/icon- Generate app icons, favicons and UI elements in multiple sizes.
/pattern- Generate seamless patterns and textures for backgrounds.
/story- Generate a sequence of images that tell a visual story or process.
/diagram- Generate technical drawings, flowcharts, architectural mockups, and more.
/nanobanana- Natural language (spoken) interface.
You can explicitly specify the type of image to generate, but this time we will generate it using natural language commands like /nanobanana.
In the repository directory where the Terraform code is located, run gemini to invoke the extension:
Execution command
If you look at the screen after execution, you can see that the generate_diagram tool is called by reading repomix-output.xml.

nanobanana-outputLet's check out the image.

By calling the diagram tool, I think the image is more organized as an architecture diagram than the image generated from Gemini's Web UI.
Conclusion
You'll be amazed at the high accuracy of nanobanana pro.
By making it possible to run it from the CLI, it can also be incorporated into CI, so it seems possible to always generate the latest architecture diagrams as the code is updated.
If you are interested in SRG, please contact us here.
