The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Shreya Shikha
ServiceNow Employee
ServiceNow Employee

As a Product Manager for Cloud Accelerate within ITOM, I've consistently heard customer feedback highlighting the complexities of creating efficient and scalable catalog items for cloud services. Many customers express a strong desire to leverage Infrastructure as Code (IaC) templates for automation but often struggle with the initial steps. To address this, I decided to create a simple catalog item using Terraform and ServiceNow’s Cloud Services Catalog.

 

In this blog, I'll share my experience building the catalog item, providing tips and tricks along the way. I'll also include links to relevant documentation for further deep dive. My goals are to:

  • Introduce Infrastructure as Code (IaC) and its benefits for ServiceNow catalog development.
  • Demonstrate how to import and transform IaC templates into blueprints.
  • Provide a step-by-step guide to building a simple catalog item using ServiceNow's Cloud Services Catalog.

 

Picture1.png

UNDERSTANDING INFRASTRUCTURE AS CODE (IaC)

Infrastructure as Code (IaC) is a powerful approach that allows you to manage and provision computing resources through machine-readable scripts, rather than manual processes. This method significantly improves efficiency and reduces errors. ServiceNow's Cloud Services Catalog supports the ingestion of various cloud-native templates, including Azure ARM, AWS CloudFormation, and Terraform, for streamlined cloud deployment orchestration. For this blog, I focused on Terraform, a widely adopted IaC tool that excels at configuring, managing, and automating infrastructure resources.

 

Note: To follow these steps effectively, it's assumed that you have the have Cloud Services Catalog store app installed and have completed the 'CSC Guided Setup'. For a hands-on experience with pre-built out-of-box catalog items, you must activate the CSC Content Pack store app.

 

CREATING A CUSTOM CATALOG ITEM USING CLOUD SERVICES CATALOG AND TERRAFOM

*Reference: Create a cloud catalog item

 

Ingesting the IaC Template:

  • Defining Terraform Scripts: The first step involved crafting Terraform configuration files for the desired infrastructure. I defined resource values like AWS EC2 instance type, AMI ID, and tags directly within the main.tf file. Additionally, I declared variables such as region and key names in variables.tf file. Finally, provider.tf specified the target environment, such as the datacenter location. While Terraform offers default options for common AWS resources like VPCs and subnets, you have the flexibility to create custom ones as well. To grant access to the AWS Service Account, I included references to the access and secret keys within provider.tf file.
  • Ensuring Configurability: To guarantee everything works as intended, I executed the following commands. I recommend following these for a smooth execution of your IaC:
    • terraform validate: Checks the syntax and structure of the configuration files.
    • terraform plan: Previews the changes Terraform will make.
    • terraform apply: Executes the plan to create the infrastructure.
  • Copying Scripts to terraform server: After making the minor changes to templates per documentation, I copied the Terraform scripts to the tmp folder in my terraform server using the command scp *.tf username@tf_ip_address.
  • Accessing Terraform Server: I logged in to the Terraform server using the command ssh username@tf_ip_address and navigated to the templates folder where OOB CSC templates are stored. I created a new folder and copied the newly created template to this location.

 

Creating the cloud catalog item:

  • Accessing Cloud Admin Portal: I logged in to my ServiceNow instance and navigated to All > Cloud Services > Cloud Admin Portal.
  • Discovering Config Installable: I selected Manage > Config Management, chose the Terraform provider card, and clicked Discover Now to initiate the IaC Discovery process. This searches for installable configurations (Terraform templates) from the Terraform Open-Source server.

Building the Cloud Services Catalog

  • Accessing Cloud Catalog Items: I navigated to Design > Cloud Catalog Items in the Cloud Admin Portal.
  • Creating a New Catalog Item: I clicked New and filled in the required fields like name, description, icon, and other details.
  • Connecting the IaC template:
    • I selected Configuration Management Template as the source and chose the configuration provider, in this case, TFO Linux Config Provider.
    • Under Related Links, I navigated to the Cloud Templates tab and clicked New to associate the terraform template to the catalog item.
    • I selected my template from the list of Configuration Installables and clicked Submit.
    • I reviewed the template details, activated it, and made sure it had an "Active" state.
  • Ensuring Employee Center Visibility: I navigated to the Connected Content tab under Related Links and linked the catalog to an existing taxonomy header. You could also create a new topic for linking the catalog.
  • Activating the Catalog Item: I reviewed the catalog item's configuration and marked it as "Active" for use.

Refer to the attached VIDEO for a detailed walkthrough of the steps:

 

CONCLUSION

Creating a custom catalog item in ServiceNow using Terraform was an enlightening experience that showcased the power and flexibility of IaC combined with ServiceNow's robust workflow capabilities.

 

NEXT STEPS

To enhance the catalog-building experience, CSC offers a variety of things:

  • Reducing the number of fields for a simplified user experience.
  • Making fields invisible to further enhance simplicity.
  • Setting up policies to automate tasks like assigning default security groups or configuring instance types and regions.
  • Implementing pre- and post-provisioning actions for tasks like instance monitoring and backup configurations.

 

Stay tuned for my next blog where I'll delve into creating policies and post-provisioning actions to further enhance your cloud management processes.

 

Happy Cloud Catalog building!

______________________________________________________

Get Started with Our Powerful Cloud Services Catalog!

Download from Store now!

See how our cloud services can help your business thrive, just like they have for many other customers! It works on PDI too. Don't wait - take control of your cloud environment today!

Comments
Ram Devanathan1
ServiceNow Employee
ServiceNow Employee

useful blog, nicely written - the video is short and good @Shreya Shikha  keep it coming

Gautham Raju
Tera Expert

Good one @Shreya Shikha

Working with simple catalogs is straightforward. However, client requirements in real-world scenarios tend to be much more complex, with numerous pre- and post-dependencies on the catalogs. Nonetheless, this marks the beginning. Cloud accelerate team has established the foundation and the structure for the house and now it is time for the interior architect to design the interiors. 

Shreya Shikha
ServiceNow Employee
ServiceNow Employee

@Gautham Raju Thank you for the valuable feedback. I appreciate you pointing out that real-world scenarios can be more complex than the initial overview I provided. While this blog aimed to introduce customers to the basics of building custom catalogs using IaC within CSC, I understand it only scratches the surface of Cloud Accelerate's capabilities. In the upcoming blogs, I will cover pre- and post-dependencies, alongside several other things we can achieve using CSC i.e. the full breadth of our product's capabilities. Stay tuned for more in-depth content!

Eita Cho
ServiceNow Employee
ServiceNow Employee

@Shreya Shikha  well done and this is very useful. Cannot wait to see the next ones

Version history
Last update:
‎08-02-2024 06:32 AM
Updated by:
Contributors