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

feat: update tf.checks step name and tf and aws version #11

Merged
merged 3 commits into from
Jan 10, 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
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ jobs:
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: '_example / Get min/max versions'
tfcheck: '_example / Check code format'
...
1 change: 0 additions & 1 deletion _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module "amplify" {
access_token = "ghp_xxxxtjq0xxxxxxxoLIMuxxxxxxBJg70txxxx" // The github access token
sub_domain_prefix_name = "scan"
deployment_artifacts = "app-example-deployment"
ttl = 5
build_spec = <<-EOT
version: 1
frontend:
Expand Down
6 changes: 3 additions & 3 deletions _example/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
output "name" {
value = module.amplify.*.name
value = module.amplify[*].name
description = "Amplify App name"

}

output "arn" {
value = module.amplify.*.arn
value = module.amplify[*].arn
description = "Amplify App ARN "

}

output "default_domain" {
value = module.amplify.*.default_domain
value = module.amplify[*].default_domain
description = "Amplify App domain (non-custom)"

}
20 changes: 8 additions & 12 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
locals {
environments = { for k, v in var.branches : k => v if var.amplify_enabled }
}

module "labels" {
source = "clouddrove/labels/aws"
version = "1.3.0"
Expand Down Expand Up @@ -66,7 +62,7 @@ resource "aws_amplify_app" "example" {
resource "aws_amplify_backend_environment" "example" {
count = var.amplify_enabled && var.backend_enable ? 1 : 0

app_id = join("", aws_amplify_app.example.*.id)
app_id = join("", aws_amplify_app.example[*].id)
environment_name = var.environment_name
deployment_artifacts = var.deployment_artifacts
stack_name = var.stack_name
Expand All @@ -75,7 +71,7 @@ resource "aws_amplify_backend_environment" "example" {
resource "aws_amplify_branch" "main" {
count = var.amplify_enabled ? 1 : 0

app_id = join("", aws_amplify_app.example.*.id)
app_id = join("", aws_amplify_app.example[*].id)
branch_name = var.branches.branch_name
display_name = var.branches.display_name
description = var.branches.description
Expand All @@ -92,28 +88,28 @@ resource "aws_amplify_domain_association" "example" {
count = var.amplify_enabled ? length(var.domain_name) : 0


app_id = join("", aws_amplify_app.example.*.id)
app_id = join("", aws_amplify_app.example[*].id)
domain_name = element(var.domain_name, count.index)
wait_for_verification = false

# https://example.com
sub_domain {
branch_name = join("", aws_amplify_branch.main.*.branch_name)
branch_name = join("", aws_amplify_branch.main[*].branch_name)
prefix = var.sub_domain_prefix_name
}

# https://www.example.com
sub_domain {
branch_name = join("", aws_amplify_branch.main.*.branch_name)
branch_name = join("", aws_amplify_branch.main[*].branch_name)
prefix = var.sub_domain_prefix_name
}
}

resource "aws_amplify_webhook" "master" {
count = var.amplify_enabled ? 1 : 0

app_id = join("", aws_amplify_app.example.*.id)
branch_name = join("", aws_amplify_branch.main.*.branch_name)
app_id = join("", aws_amplify_app.example[*].id)
branch_name = join("", aws_amplify_branch.main[*].branch_name)
description = "triggermaster"

}
}
6 changes: 3 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
output "name" {
description = "Amplify App name"
value = join("", aws_amplify_app.example.*.name)
value = join("", aws_amplify_app.example[*].name)
}

output "arn" {
description = "Amplify App ARN "
value = join("", aws_amplify_app.example.*.arn)
value = join("", aws_amplify_app.example[*].arn)
}

output "default_domain" {
description = "Amplify App domain (non-custom)"
value = join("", aws_amplify_app.example.*.default_domain)
value = join("", aws_amplify_app.example[*].default_domain)
}
7 changes: 1 addition & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ variable "stack_name" {
default = "amplify-app-example"
description = "AWS CloudFormation stack name of a backend environment."
}
variable "ttl" {
type = number
default = null
description = "Content Time To Live (TTL) for the website in seconds."
}

variable "custom_rules" {
type = list(object({
Expand Down Expand Up @@ -194,4 +189,4 @@ variable "branches" {
environment_variables = optional(map(string))
})
nullable = false
}
}