-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chandra-demo
- Loading branch information
Showing
27 changed files
with
250 additions
and
23 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
name: EC2 deployment | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.external_modules/ | ||
.DS_Store |
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
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,15 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "~>3.31.0" | ||
} | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
subscription_id = var.subscription_id | ||
tenant_id = var.tenant_id | ||
features {} | ||
skip_provider_registration = true | ||
} |
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,36 @@ | ||
resource "azurerm_storage_account" "storage_acc" { | ||
# checkov:skip=CKV_AZURE_59: Public network access required for demo bucket | ||
# checkov:skip=CKV2_AZURE_18: No CMK needed for demo bucket | ||
# checkov:skip=CKV2_AZURE_1: No CMK needed for demo bucket | ||
# checkov:skip=CKV_AZURE_33: No logging needed for demo bucket | ||
count = var.create_storage ? 1 : 0 | ||
name = "${random_string.password.result}cnappdemo" | ||
resource_group_name = var.create_requirements ? azurerm_resource_group.rg[0].name : var.resource_group_name | ||
account_replication_type = "LRS" | ||
location = var.region | ||
account_tier = "Standard" | ||
min_tls_version = "TLS1_2" | ||
} | ||
|
||
resource "azurerm_storage_container" "storage_container" { | ||
# checkov:skip=CKV_AZURE_34: Public access needed for demo purposes | ||
# checkov:skip=CKV2_AZURE_21: No logging needed for demo bucket | ||
count = var.create_storage ? 1 : 0 | ||
name = "${random_string.password.result}cnappdemo" | ||
container_access_type = "blob" | ||
storage_account_name = azurerm_storage_account.storage_acc[0].name | ||
} | ||
|
||
resource "azurerm_role_assignment" "storage_blob_data_owner_user" { | ||
count = var.create_storage ? 1 : 0 | ||
role_definition_name = "Storage Blob Data Owner" | ||
principal_id = data.azuread_client_config.current.object_id | ||
scope = azurerm_storage_account.storage_acc[0].id | ||
} | ||
|
||
resource "azurerm_role_assignment" "storage_blob_data_owner_pod" { | ||
count = var.create_storage ? 1 : 0 | ||
role_definition_name = "Storage Blob Data Owner" | ||
principal_id = azurerm_user_assigned_identity.cnappdemo.principal_id | ||
scope = azurerm_storage_account.storage_acc[0].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
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
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,54 @@ | ||
resource "aws_s3_bucket" "s3b" { | ||
# checkov:skip=CKV2_AWS_6: Public access blocks not needed for a demo bucket | ||
# checkov:skip=CKV_AWS_145: KMS not needed for a demo bucket | ||
# checkov:skip=CKV_AWS_18: Access logging not deeded for a demo bucket | ||
# checkov:skip=CKV_AWS_144: Region cross-replication not needed for a demo bucket | ||
# checkov:skip=CKV_AWS_21: Versioning not needed for a demo bucket | ||
bucket = var.s3_bucket_name | ||
} | ||
|
||
resource "aws_s3_bucket_public_access_block" "pab" { | ||
# checkov:skip=CKV_AWS_55: Public access ACL needed for demo purposes. | ||
# checkov:skip=CKV_AWS_54: Public access ACL needed for demo purposes. | ||
# checkov:skip=CKV_AWS_53: Public access ACL needed for demo purposes. | ||
bucket = aws_s3_bucket.s3b.bucket | ||
|
||
block_public_acls = false | ||
block_public_policy = false | ||
ignore_public_acls = false | ||
restrict_public_buckets = true | ||
} | ||
|
||
resource "aws_s3_bucket_policy" "allow_upload" { | ||
bucket = aws_s3_bucket.s3b.bucket | ||
policy = data.aws_iam_policy_document.allow_upload.json | ||
} | ||
|
||
data "aws_iam_policy_document" "allow_upload" { | ||
statement { | ||
actions = [ | ||
"s3:AbortMultipartUpload", | ||
"s3:ListBucket", | ||
"s3:ListBucketMultipartUploads", | ||
"s3:ListMultipartUploadParts", | ||
"s3:PutObject", | ||
"s3:PutObjectAcl" | ||
] | ||
principals { | ||
type = "AWS" | ||
identifiers = [module.eks.eks_managed_node_groups.one.iam_role_arn] | ||
} | ||
resources = [ | ||
aws_s3_bucket.s3b.arn, | ||
"${aws_s3_bucket.s3b.arn}/*" | ||
] | ||
} | ||
} | ||
|
||
resource "aws_s3_bucket_ownership_controls" "object_writer" { | ||
bucket = aws_s3_bucket.s3b.bucket | ||
|
||
rule { | ||
object_ownership = "ObjectWriter" | ||
} | ||
} |
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
Oops, something went wrong.