Skip to content

Commit

Permalink
docs: include an Azure example
Browse files Browse the repository at this point in the history
  • Loading branch information
alikhajeh1 committed Jan 9, 2024
1 parent 4bde71d commit 5c906ef
Showing 1 changed file with 71 additions and 3 deletions.
74 changes: 71 additions & 3 deletions docs/infracost_cloud/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ If you do not use the GitHub App or GitLab App integrations, you need to impleme

### 4. Send a pull request

In your code repo, create a new branch and add the following example Terraform code into your `main.tf` file (or equivalent). Commit and push the change, then use the branch to send a new pull request. Infracost should post a pull request comment showing the cost estimate as well as FinOps best practices that could be considered.
In your code repo, create a new branch. In the test branch, add a new folder called "infracost_test" and in there add a `main.tf` file with the following example Terraform code. Commit and push the change, then use the branch to send a new pull request. Infracost should post a pull request comment showing the cost estimate as well as FinOps best practices that could be considered.

<details><summary>Example Terraform code</summary>
<details><summary>Example AWS Terraform code</summary>

```hcl
provider "aws" {
Expand All @@ -56,18 +56,86 @@ resource "aws_instance" "web_app" {
}
}
```
</details>

In the above example, the Infracost pull request comment points out that:
1. The `root_block_device` defaults to AWS `gp2` since `volume_type` has not been specified. You should consider using `gp3` as it enables you to define performance independent of storage capacity, while providing up to 20% lower price per GB.
2. Also, the `m3` instance type is previous generation and should be upgraded to `m5` since that gives you a 27% saving for a more performant machine.

</details>

<details><summary>Example Azure Terraform code</summary>

```hcl
provider "azurerm" {
skip_provider_registration = true
features {}
}
resource "azurerm_linux_virtual_machine" "my_vm" {
name = "basic_a2"
resource_group_name = "fake_resource_group"
location = "eastus"
size = "Basic_A2" # <<<<< Try changing this to Basic_A4 to compare the costs
tags = {
Environment = "production"
Service = "web-app"
}
network_interface_ids = [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/fakenic",
]
admin_username = "fakeuser"
admin_password = "fakepass"
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
}
resource "azurerm_app_service_plan" "my_app" {
name = "api-appserviceplan-pro"
location = "eastus"
resource_group_name = "fake_resource_group"
kind = "elastic"
reserved = false
sku {
tier = "PremiumV2"
size = "P1v2"
capacity = 2
}
tags = {
Environment = "Prod"
Service = "web-app"
}
}
```

In the above example, the Infracost pull request comment points out that:
1. The `Basic_A2` instance type is previous generation and should be upgraded to an Av2-series machine, such as `Standard_A2_v2`, since that gives you a more performant machine.
2. The `PremiumV2` App Service plan should be upgraded to a v3 plan, such as `P0v3` (with `tier=PremiumV3`), since that gives you more performance and is eligible for savings plans and reserved instance pricing, opening opportunities for major savings.

</details>

### 5. See cost estimate in Infracost Cloud

Go to [**Infracost Cloud**](https://dashboard.infracost.io) > **your organization** > **Visibility** > **Pull requests** to see all pull requests in a central place. You can also filter and sort them and check their details.

<img src={useBaseUrl("img/infracost-cloud/pull-requests-tab.png")} alt="Infracost Cloud shows pull request cost changes" />

Note that the dashboard only includes merged pull requests.

### 6. Add your team members

Use the Members page to [invite](/docs/infracost_cloud/key_concepts/#team-management) your team members to join your organization.
Expand Down

1 comment on commit 5c906ef

@aliscott
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Please sign in to comment.