mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
destroy condition
This commit is contained in:
parent
0c9dada642
commit
12185bffa6
3 changed files with 21 additions and 7 deletions
13
.github/workflows/_deploy_lambda.yml
vendored
13
.github/workflows/_deploy_lambda.yml
vendored
|
|
@ -29,6 +29,12 @@ on:
|
|||
default: 'false'
|
||||
# can only be 'true' or 'false'
|
||||
|
||||
terraform_destroy:
|
||||
required: false
|
||||
type: string
|
||||
default: 'false'
|
||||
# can only be 'true' or 'false'
|
||||
|
||||
secrets:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
required: true
|
||||
|
|
@ -93,6 +99,11 @@ jobs:
|
|||
-out=lambdaplan
|
||||
|
||||
- name: Terraform Apply
|
||||
if: inputs.terraform_apply == 'true' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
|
||||
if: (inputs.terraform_apply == 'true' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') && inputs.terraform_destroy != 'true'
|
||||
working-directory: ${{ inputs.lambda_path }}
|
||||
run: terraform apply -auto-approve lambdaplan
|
||||
|
||||
- name: Terraform Destroy
|
||||
if: inputs.terraform_destroy == 'true'
|
||||
working-directory: ${{ inputs.lambda_path }}
|
||||
run: terraform destroy -auto-approve
|
||||
|
|
|
|||
1
.github/workflows/deploy_terraform.yml
vendored
1
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -186,6 +186,7 @@ jobs:
|
|||
stage: ${{ needs.determine_stage.outputs.stage }}
|
||||
ecr_repo: condition-etl-${{ needs.determine_stage.outputs.stage }}
|
||||
image_digest: ${{ needs.condition_etl_image.outputs.image_digest }}
|
||||
terraform_destroy: 'true'
|
||||
secrets:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ resource "aws_iam_policy" "s3_policy" {
|
|||
policy = jsonencode({
|
||||
Version = "2012-10-17"
|
||||
Statement = [
|
||||
{
|
||||
Effect = "Allow"
|
||||
Action = var.actions
|
||||
Resource = local.resources
|
||||
Condition = var.conditions != null ? var.conditions : null
|
||||
}
|
||||
merge(
|
||||
{
|
||||
Effect = "Allow"
|
||||
Action = var.actions
|
||||
Resource = local.resources
|
||||
},
|
||||
var.conditions != null ? { Condition = var.conditions } : {}
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue