Skip to content

Commit

Permalink
Updated the pipelines with Connection Type and Credential Import chan…
Browse files Browse the repository at this point in the history
…ges (#20)



Co-authored-by: Cody Bruno <[email protected]>
Co-authored-by: misraved <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent 972e760 commit c286453
Show file tree
Hide file tree
Showing 86 changed files with 452 additions and 450 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ brew tap turbot/tap
brew install flowpipe
```

### Credentials
### Connections

By default, the following environment variables will be used for authentication:

Expand All @@ -30,21 +30,21 @@ By default, the following environment variables will be used for authentication:
- `AZURE_ENVIRONMENT`
- `AZURE_TENANT_ID`

You can also create `credential` resources in configuration files:
You can also create `connection` resources in configuration files:

```sh
vi ~/.flowpipe/config/azure.fpc
```

```hcl
credential "azure" "default" {
connection "azure" "default" {
client_id = "<your client id>"
client_secret = "<your client secret>"
tenant_id = "<your tenant id>"
}
```

For more information on credentials in Flowpipe, please see [Managing Credentials](https://flowpipe.io/docs/run/credentials).
For more information on connections in Flowpipe, please see [Managing Connections](https://flowpipe.io/docs/run/connections).

### Usage

Expand Down Expand Up @@ -108,10 +108,10 @@ Run a pipeline:
flowpipe pipeline run create_compute_virtual_machine --arg vm_name='VM Dev' --arg vm_image=Ubuntu2204 --arg subscription_id=1234-5678-9012-3456 --arg resource_group=my-rg
```

To use a specific `credential`, specify the `cred` pipeline argument:
To use a specific `connection`, specify the `conn` pipeline argument:

```sh
flowpipe pipeline run list_compute_virtual_machines --arg cred=azure_prod --arg subscription_id=1234-5678-9012-3456 --arg resource_group=my-rg
flowpipe pipeline run list_compute_virtual_machines --arg conn=connection.azure.azure_prod --arg subscription_id=1234-5678-9012-3456 --arg resource_group=my-rg
```

## Open Source & Contributing
Expand Down
2 changes: 1 addition & 1 deletion locals.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
locals {
client_id_param_description = "The client (application) ID of an App Registration in the tenant."
client_secret_param_description = "A client secret that was generated for the App Registration."
cred_param_description = "Name for credentials to use. If not provided, the default credentials will be used."
conn_param_description = "Name of Azure connection to use. If not provided, the default Azure connection will be used."
resource_group_param_description = "Azure Resource Group. Examples: my-rg, my-rg-123."
subscription_id_param_description = "Azure Subscription Id. Examples: d46d7416-f95f-4771-bbb5-529d4c766."
tenant_id_param_description = "The Microsoft Entra ID tenant (directory) ID."
Expand Down
8 changes: 7 additions & 1 deletion mod.fp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ mod "azure" {
color = "#0089D6"
documentation = file("./README.md")
icon = "/images/mods/turbot/azure.svg"
categories = ["public cloud"]
categories = ["library", "public cloud"]

opengraph {
title = "Azure Mod for Flowpipe"
description = "Run pipelines to supercharge your Azure workflows using Flowpipe."
image = "/images/mods/turbot/azure-social-graphic.png"
}

require {
flowpipe {
min_version = "1.0.0"
}
}
}
12 changes: 6 additions & 6 deletions pipelines/appservice/assign_appservice_webapp_identity.fp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline "assign_appservice_webapp_identity" {
description = "Assign a managed identity to an Azure AppService Web App."

tags = {
type = "featured"
recommended = "true"
}

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -35,7 +35,7 @@ pipeline "assign_appservice_webapp_identity" {
"--name", param.app_name
]

env = credential.azure[param.cred].env
env = param.conn.env
}

output "assign_appservice_webapp_identity" {
Expand Down
10 changes: 5 additions & 5 deletions pipelines/appservice/delete_app_service_plan.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "delete_app_service_plan" {
title = "Delete App Service Plan"
description = "Delete an Azure App Service Plan."

param "cred" {
type = string
description = "The credentials to use for authentication."
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -27,6 +27,6 @@ pipeline "delete_app_service_plan" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["appservice", "plan", "delete", "--yes", "-g", param.resource_group, "--subscription", param.subscription_id, "-n", param.service_plan_name]

env = credential.azure[param.cred].env
env = param.conn.env
}
}
12 changes: 6 additions & 6 deletions pipelines/appservice/set_ftps_config_appservice_webapp.fp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline "set_config_appservice_webapp" {
description = "Set the configuration for an Azure Web App."

tags = {
type = "featured"
recommended = "true"
}

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand Down Expand Up @@ -53,7 +53,7 @@ pipeline "set_config_appservice_webapp" {
param.enable_http2 != null ? ["--http20-enabled", "true"] : [],
param.tls_version != null ? concat(["--min-tls-version", param.tls_version]) : []
)
env = credential.azure[param.cred].env
env = param.conn.env
}

output "config_webapp" {
Expand Down
12 changes: 6 additions & 6 deletions pipelines/appservice/update_appservice_webapp.fp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline "update_appservice_webapp" {
description = "Update setting for an Azure Web App."

tags = {
type = "featured"
recommended = "true"
}

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand Down Expand Up @@ -41,7 +41,7 @@ pipeline "update_appservice_webapp" {
"--set", "httpsOnly=${param.https_only}"
]

env = credential.azure[param.cred].env
env = param.conn.env
}

output "update_appservice_webapp" {
Expand Down
12 changes: 6 additions & 6 deletions pipelines/appservice/update_appservice_webapp_auth.fp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline "update_appservice_webapp_auth" {
description = "Update the authentication settings of an Azure Web App."

tags = {
type = "featured"
recommended = "true"
}

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand Down Expand Up @@ -38,7 +38,7 @@ pipeline "update_appservice_webapp_auth" {
["webapp", "auth", "update", "--resource-group", param.resource_group, "--name", param.app_name, "--enabled", tostring(param.enabled)]
)

env = credential.azure[param.cred].env
env = param.conn.env
}

output "webapp_auth" {
Expand Down
10 changes: 5 additions & 5 deletions pipelines/compute/attach_compute_disk.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "attach_compute_disk" {
title = "Attach Compute Disk"
description = "Attach a managed persistent disk to a VM."

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -32,7 +32,7 @@ pipeline "attach_compute_disk" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["vm", "disk", "attach", "--vm-name", param.vm_name, "-g", param.resource_group, "-n", param.disk_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}

output "disk" {
Expand Down
12 changes: 6 additions & 6 deletions pipelines/compute/create_compute_virtual_machine.fp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pipeline "create_compute_virtual_machine" {
description = "Create an Azure Virtual Machine."

tags = {
type = "featured"
recommended = "true"
}

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand Down Expand Up @@ -94,7 +94,7 @@ pipeline "create_compute_virtual_machine" {
param.network_security_group_name != null ? concat(["--nsg", param.network_security_group_name]) : [],
)

env = credential.azure[param.cred].env
env = param.conn.env
}

output "virtual_machine" {
Expand Down
10 changes: 5 additions & 5 deletions pipelines/compute/deallocate_compute_virtual_machine.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "deallocate_compute_virtual_machine" {
title = "Deallocate Compute Virtual Machine"
description = "Deallocate a VM so that computing resources are no longer allocated (charges no longer apply). The status will change from Stopped to Stopped (Deallocated)."

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -27,6 +27,6 @@ pipeline "deallocate_compute_virtual_machine" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["vm", "deallocate", "-g", param.resource_group, "-n", param.vm_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}
}
10 changes: 5 additions & 5 deletions pipelines/compute/delete_compute_disk.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "delete_compute_disk" {
title = "Delete Compute Disk"
description = "Delete a managed disk."

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -27,7 +27,7 @@ pipeline "delete_compute_disk" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["disk", "delete", "--yes", "-g", param.resource_group, "-n", param.disk_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}

}
10 changes: 5 additions & 5 deletions pipelines/compute/delete_compute_snapshot.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "delete_compute_snapshot" {
title = "Delete Compute Snapshot"
description = "Delete a compute snapshot."

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -27,7 +27,7 @@ pipeline "delete_compute_snapshot" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["snapshot", "delete", "-g", param.resource_group, "-n", param.snapshot_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}

}
10 changes: 5 additions & 5 deletions pipelines/compute/delete_compute_virtual_machine.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pipeline "delete_compute_virtual_machine" {
title = "Delete Compute Virtual Machine"
description = "Delete a VM."

param "cred" {
type = string
description = local.cred_param_description
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
Expand All @@ -27,6 +27,6 @@ pipeline "delete_compute_virtual_machine" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["vm", "delete", "--yes", "-g", param.resource_group, "-n", param.vm_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}
}
13 changes: 6 additions & 7 deletions pipelines/compute/delete_compute_virtual_machine_scale_set.fp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ pipeline "delete_virtual_machine_scale_set" {
title = "Delete Virtual Machine Scale Set"
description = "Delete an Azure Virtual Machine Scale Set."

param "cred" {
type = string
description = "The credentials to use for authentication."
default = "default"
param "conn" {
type = connection.azure
description = local.conn_param_description
default = connection.azure.default
}

param "subscription_id" {
param "subscription_id" {
type = string
description = "The Azure subscription ID."
}
Expand All @@ -21,13 +21,12 @@ pipeline "delete_virtual_machine_scale_set" {
param "vmss_name" {
type = string
description = "The name of the Virtual Machine Scale Set."
default = "test9000"
}

step "container" "delete_virtual_machine_scale_set" {
image = "ghcr.io/turbot/flowpipe-image-azure-cli"
cmd = ["vmss", "delete", "-g", param.resource_group, "-n", param.vmss_name, "--subscription", param.subscription_id]

env = credential.azure[param.cred].env
env = param.conn.env
}
}
Loading

0 comments on commit c286453

Please sign in to comment.