-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from aboutte/pipeline
adding tf pipelines
- Loading branch information
Showing
38 changed files
with
1,753 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,86 @@ | ||
name: SetUp the sales demo | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
module: | ||
description: Module to run | ||
type: choice | ||
default: foundation | ||
options: | ||
- admin-tenant | ||
- aws-services | ||
- app | ||
cmd: | ||
description: Command to run | ||
type: choice | ||
default: plan | ||
options: | ||
- plan | ||
- apply | ||
- destroy | ||
environment: | ||
description: Environment to deploy to | ||
type: environment | ||
default: salesdemo | ||
workspace: | ||
description: Workspace to run | ||
type: string | ||
default: default | ||
|
||
workflow_call: | ||
inputs: | ||
cmd: | ||
description: Command to run | ||
type: string | ||
default: plan | ||
environment: | ||
description: Environment to deploy to | ||
type: string | ||
default: dev | ||
module: | ||
description: Module to run | ||
type: string | ||
default: admin-tenant | ||
workspace: | ||
description: Workspace to run | ||
type: string | ||
default: default | ||
secrets: | ||
DUPLO_TOKEN: | ||
description: Duplo Token | ||
required: true | ||
jobs: | ||
module: | ||
name: ${{ inputs.cmd }} ${{ inputs.workspace }} foundation | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ inputs.environment }} | ||
env: | ||
DUPLO_TOKEN: ${{ secrets.DUPLO_TOKEN }} | ||
DUPLO_HOST: ${{ vars.DUPLO_HOST }} | ||
DUPLO_TENANT: ${{ vars.DUPLO_TENANT }} | ||
TF_CLI_ARGS_apply: -parallelism=1 | ||
steps: | ||
|
||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Duplo and AWS Setup | ||
uses: duplocloud/actions/setup@main | ||
|
||
- name: Terraform Setup | ||
uses: duplocloud/actions/setup-terraform@main | ||
|
||
- name: TF Validate Module | ||
uses: duplocloud/actions/terraform-module@main | ||
with: | ||
module: modules/foundation | ||
test: false | ||
|
||
- name: TF Execute Module | ||
uses: duplocloud/actions/terraform-exec@main | ||
with: | ||
module: iac/${{ inputs.module }} | ||
workspace: ${{ inputs.workspace }} | ||
command: ${{ inputs.cmd }} |
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
crash.*.log | ||
duplo.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sentitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
# | ||
#*.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
target/** |
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 @@ | ||
1.5.5 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
terraform { | ||
backend "s3" { | ||
region = "us-west-2" | ||
key = "tenant" | ||
workspace_key_prefix = "admin:" | ||
encrypt = 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,23 @@ | ||
locals { | ||
plan_id = var.infra_name | ||
tenant_name = terraform.workspace | ||
region = data.duplocloud_infrastructure.infra.region | ||
} | ||
|
||
data "duplocloud_infrastructure" "infra" { | ||
infra_name = var.infra_name | ||
} | ||
|
||
resource "duplocloud_tenant" "tenant" { | ||
account_name = local.tenant_name | ||
plan_id = local.plan_id | ||
allow_deletion = true | ||
} | ||
|
||
resource "duplocloud_tenant_config" "tenant-config" { | ||
tenant_id = duplocloud_tenant.tenant.tenant_id | ||
setting { | ||
key = "delete_protection" | ||
value = "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,22 @@ | ||
output "tenant_name" { | ||
value = duplocloud_tenant.tenant.account_name | ||
description = "The tenant name" | ||
} | ||
output "tenant_id" { | ||
value = duplocloud_tenant.tenant.tenant_id | ||
description = "The tenant ID" | ||
} | ||
|
||
output "infra_name" { | ||
value = data.duplocloud_infrastructure.infra.infra_name | ||
description = "The duplo infra name." | ||
} | ||
output "vpc_id" { | ||
value = data.duplocloud_infrastructure.infra.vpc_id | ||
description = "The VPC or VNet ID." | ||
} | ||
output "region" { | ||
value = local.region | ||
description = "The AWS region the Tenant is located in" | ||
} | ||
|
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_version = ">= 1.5.5" | ||
required_providers { | ||
duplocloud = { | ||
source = "duplocloud/duplocloud" | ||
version = "~> 0.10.2" | ||
} | ||
} | ||
} | ||
provider "duplocloud" { | ||
|
||
} | ||
provider "aws" { | ||
region = local.region | ||
} |
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,8 @@ | ||
variable "region" { | ||
default = "us-west-2" | ||
type = string | ||
} | ||
variable "infra_name" { | ||
type = string | ||
default = "prod-infra" | ||
} |
Oops, something went wrong.