-
Notifications
You must be signed in to change notification settings - Fork 2
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
add secure_storage_connector module #58
Draft
levinandrew
wants to merge
7
commits into
main
Choose a base branch
from
levinandrew/secure_storage_connector
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
774fb1f
add secure_storage_connector module
levinandrew e9d804d
cleanup
levinandrew 0f2417c
register multi-tenant service principal
levinandrew 596fd0c
gen cert in vault
levinandrew 3c2d9f7
Revert "gen cert in vault"
levinandrew 8490a80
cors for customer bucket
levinandrew 226bb35
terraform-docs: automated action
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
data "azuread_client_config" "current" {} | ||
|
||
resource "azuread_application" "example" { | ||
display_name = "${var.namespace} Application" | ||
owners = [data.azuread_client_config.current.object_id] | ||
sign_in_audience = "AzureADMultipleOrgs" | ||
} | ||
|
||
resource "azuread_service_principal" "example" { | ||
client_id = azuread_application.example.client_id | ||
app_role_assignment_required = false | ||
owners = [data.azuread_client_config.current.object_id] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "namespace" { | ||
type = string | ||
description = "Friendly name prefix used for tagging and naming Azure resources." | ||
} | ||
|
||
#variable "resource_group_name" { | ||
# description = "Resource Group name" | ||
# type = string | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
resource "azurerm_resource_group" "group" { | ||
name = "${var.namespace}-resources" | ||
location = var.location | ||
} | ||
|
||
resource "azurerm_storage_account" "account" { | ||
name = "${var.namespace}storageaccount" | ||
resource_group_name = azurerm_resource_group.group.name | ||
location = azurerm_resource_group.group.location | ||
account_tier = "Standard" | ||
account_replication_type = "LRS" | ||
is_hns_enabled = "true" | ||
|
||
blob_properties { | ||
cors_rule { | ||
allowed_headers = ["*"] | ||
allowed_methods = ["GET", "HEAD", "PUT"] | ||
allowed_origins = ["*"] | ||
exposed_headers = ["*"] | ||
max_age_in_seconds = 3600 | ||
} | ||
} | ||
} | ||
|
||
resource "azurerm_storage_container" "container" { | ||
name = "${var.namespace}-container" | ||
storage_account_name = azurerm_storage_account.account.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_role_assignment" "principal" { | ||
scope = azurerm_storage_account.account.id | ||
role_definition_name = "Storage Blob Data Owner" | ||
principal_id = var.azure_principal_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "principal2" { | ||
scope = azurerm_storage_account.account.id | ||
role_definition_name = "Storage Account Contributor" | ||
principal_id = var.azure_principal_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "storage_account_name" { | ||
value = azurerm_storage_account.account.name | ||
} | ||
|
||
output "container_name" { | ||
value = azurerm_storage_container.container.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "namespace" { | ||
type = string | ||
description = "Prefix to use when creating resources" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "The Azure Region where resources will be created" | ||
} | ||
|
||
variable "azure_principal_id" { | ||
description = "Azure principal ID that can access the blob storage" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to create a multi-tenant service principal
https://stackoverflow.com/questions/65696539/how-to-create-a-multi-tenant-service-principal-in-azure-using-terraform/65696750#65696750
And
available_to_other_tenants
has been deprecated and replaced withsign_in_audience
in the AzureAD v2.0 and Microsoft Graph docs