Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sftp terraform module AB#21005 #428

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions modules/azure/api_connectors/sftp_ssh/connection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "String",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "location"
}
},
"connection_name": {
"type": "String",
"metadata": {
"description": "Connection resource name to connect to sftp ssh."
}
},
"password": {
"type": "string",
"metadata": {
"description": "The sftp password"
}
},
"username": {
"type": "string",
"metadata": {
"description": "The sftp username"
}
},
"hostname": {
"type": "string",
"metadata": {
"description": "The sftp hostName"
}
}
},
"resources": [
{
"name": "[parameters('connection_name')]",
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "SFTP - SSH",
"parameterValues": {
"hostName": "[parameters('hostname')]",
"password": "[parameters('password')]",
"userName": "[parameters('username')]",
"acceptAnySshHostKey": true
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location ,'/managedApis/sftpwithssh')]"
}
}
}
]
}
38 changes: 38 additions & 0 deletions modules/azure/api_connectors/sftp_ssh/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
terraform {
required_version = "~> 1.3"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.48"
}
}

backend "azurerm" {}
}

provider "azurerm" {
features {}
}

resource "azurerm_resource_group_template_deployment" "sftp_ssh" {
name = "${var.connection_name}_deployment"
resource_group_name = var.resource_group_name

template_content = file("./connection.json")
parameters_content = jsonencode({
"connection_name" = {
value = var.connection_name
}
"password" = {
value = var.sftp_password
}
"username" = {
value = var.sftp_username
}
"hostname" = {
value = var.sftp_hostname
}
})
deployment_mode = "Incremental"
}
3 changes: 3 additions & 0 deletions modules/azure/api_connectors/sftp_ssh/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "name" {
value = var.connection_name
patrik-pa4k marked this conversation as resolved.
Show resolved Hide resolved
}
25 changes: 25 additions & 0 deletions modules/azure/api_connectors/sftp_ssh/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
variable "resource_group_name" {
type = string
description = "Resource group this connection should be placed in"
}

variable "connection_name" {
type = string
description = "The name the connection should have"
}

variable "sftp_password" {
type = string
description = "The sftp password"
}

variable "sftp_username" {
type = string
description = "The sftp username"
}

variable "sftp_hostname" {
type = string
description = "The sftp hostname"
}