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

[DevOps] Table Storage용 bicep 파일 만들기 #283 #292

Merged
merged 21 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f198d50
add : storage account 기본 bicep
tae0y Aug 31, 2024
0d5b7a8
update : bicep에서 테이블 목록 정의
tae0y Aug 31, 2024
7e38848
update : storage account 고유한 이름 부여
tae0y Sep 1, 2024
bb711e5
update : bicep 파일구조 변경, 불필요 변경 원복
tae0y Sep 3, 2024
32d112a
update : bicep 각주추가
tae0y Sep 3, 2024
4a9b9ca
update : table 생성 구문 수정
tae0y Sep 3, 2024
9b0d1af
Merge branch 'aliencube:main' into feature/283-table-storage-bicep
tae0y Sep 6, 2024
504e774
update : connectionstring을 keyvault에 저장
tae0y Sep 7, 2024
9cdc78b
Merge branch 'feature/283-table-storage-bicep' of https://github.com/…
tae0y Sep 7, 2024
24689c5
staging : checkout전 작업사항 정리
tae0y Sep 7, 2024
c1895ea
update : connection string을 정상적으로 참조
tae0y Sep 7, 2024
8162793
update : 권한설정 placeholder 구문 추가
tae0y Sep 7, 2024
ac8426e
update : 권한설정 구문 임시 주석처리
tae0y Sep 7, 2024
ff4ef4b
update : storage-account.bicep 내부에서 connection string 저장
tae0y Sep 7, 2024
03939f2
update : aspire.bicep으로 secret 저장위치 변경
tae0y Sep 10, 2024
e0f344a
Merge branch 'main' into feature/283-table-storage-bicep
tae0y Sep 11, 2024
3721813
delete : 불필요 로컬파일 삭제
tae0y Sep 11, 2024
172629c
update : storage-account.bicep 내부에서 연결문자열 처리
tae0y Sep 13, 2024
1c3af3a
update : storage connection string 이름 변경
tae0y Sep 13, 2024
9154974
Merge branch 'main' into feature/283-table-storage-bicep
tae0y Sep 14, 2024
ffc44c3
update : storage connection string 이름 변경
tae0y Sep 14, 2024
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
19 changes: 19 additions & 0 deletions infra/aspire.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ var resourceToken = uniqueString(resourceGroup().id)
#disable-next-line no-unused-vars
// var apiServiceName = 'python-api'


// Define tables for the storage account
param tables array = [
{
name: 'events'
}
]

// Add resources to be provisioned below.

// Provision Key Vault
Expand All @@ -54,6 +62,17 @@ module keyVault './core/security/keyvault.bicep' = {
}
}

// Provision Storage Account
module storageAccount 'core/storage/storage-account.bicep' = {
name: 'storageAccount'
params: {
name: 'st${resourceToken}'
location: location
tags: tags
tables: tables
}
}

// Add outputs from the deployment here, if needed.
//
// This allows the outputs to be referenced by other bicep deployments in the deployment pipeline,
Expand Down
107 changes: 107 additions & 0 deletions infra/core/storage/storage-account.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
metadata description = 'Creates an Azure storage account.'
param name string
param location string = resourceGroup().location
param tags object = {}

@allowed([
'Cool'
'Hot'
'Premium' ])
param accessTier string = 'Hot'
param allowBlobPublicAccess bool = true
param allowCrossTenantReplication bool = true
param allowSharedKeyAccess bool = true
param containers array = []
param corsRules array = []
param defaultToOAuthAuthentication bool = false
param deleteRetentionPolicy object = {}
@allowed([ 'AzureDnsZone', 'Standard' ])
param dnsEndpointType string = 'Standard'
param files array = []
param kind string = 'StorageV2'
param minimumTlsVersion string = 'TLS1_2'
param queues array = []
param shareDeleteRetentionPolicy object = {}
param supportsHttpsTrafficOnly bool = true
param tables array = []
param networkAcls object = {
bypass: 'AzureServices'
defaultAction: 'Allow'
}
@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccess string = 'Enabled'
param sku object = { name: 'Standard_LRS' }

resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: name
location: location
tags: tags
kind: kind
sku: sku
properties: {
accessTier: accessTier
allowBlobPublicAccess: allowBlobPublicAccess
allowCrossTenantReplication: allowCrossTenantReplication
allowSharedKeyAccess: allowSharedKeyAccess
defaultToOAuthAuthentication: defaultToOAuthAuthentication
dnsEndpointType: dnsEndpointType
minimumTlsVersion: minimumTlsVersion
networkAcls: networkAcls
publicNetworkAccess: publicNetworkAccess
supportsHttpsTrafficOnly: supportsHttpsTrafficOnly
}

resource blobServices 'blobServices' = if (!empty(containers)) {
name: 'default'
properties: {
cors: {
corsRules: corsRules
}
deleteRetentionPolicy: deleteRetentionPolicy
}
resource container 'containers' = [for container in containers: {
name: container.name
properties: {
// todo: Warning use-safe-access: Use the safe access (.?) operator instead of checking object contents with the 'contains' function. [https://aka.ms/bicep/linter/use-safe-access]
publicAccess: contains(container, 'publicAccess') ? container.publicAccess : 'None'
}
}]
}

resource fileServices 'fileServices' = if (!empty(files)) {
name: 'default'
properties: {
cors: {
corsRules: corsRules
}
shareDeleteRetentionPolicy: shareDeleteRetentionPolicy
}
}

resource queueServices 'queueServices' = if (!empty(queues)) {
name: 'default'
properties: {

}
resource queue 'queues' = [for queue in queues: {
name: queue.name
properties: {
metadata: {}
}
}]
}

resource tableServices 'tableServices' = if (!empty(tables)) {
name: 'default'
properties: {}
// create tables pre-defined in aspire.bicep
resource table 'tables' = [for table in tables: {
name: table.name
properties: {}
}]
}
}

output id string = storage.id
output name string = storage.name
output primaryEndpoints object = storage.properties.primaryEndpoints
Loading