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

Update main.tf to latest TF 0.12.9 for Child Workspaces #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.DS_Store
36 changes: 0 additions & 36 deletions api-pushCode.py

This file was deleted.

16 changes: 8 additions & 8 deletions aws_config.tf
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
}

resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}

resource "aws_subnet" "development" {
vpc_id = "${aws_vpc.main.id}"
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"

tags = {
Name = "development"
}
}

resource "aws_subnet" "staging" {
vpc_id = "${aws_vpc.main.id}"
resource "aws_subnet" "stage" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.2.0/24"

tags = {
Name = "staging"
Name = "stage"
}
}

resource "aws_subnet" "production" {
vpc_id = "${aws_vpc.main.id}"
vpc_id = aws_vpc.main.id
cidr_block = "10.0.3.0/24"

tags = {
Expand Down
78 changes: 39 additions & 39 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
provider "tfe" {
hostname = "${var.hostname}"
token = "${var.token}"
hostname = var.hostname
token = var.token
}

resource "tfe_team" "developers" {
name = "${var.use_case_name}-developers"
organization = "${var.org}"
organization = var.org
}

resource "tfe_team" "ops" {
name = "${var.use_case_name}-production"
organization = "${var.org}"
organization = var.org
}

resource "tfe_team_member" "dev-user" {
Expand All @@ -29,10 +29,10 @@ resource "tfe_team_access" "development-dev" {
workspace_id = "${tfe_workspace.development.id}"
}

resource "tfe_team_access" "staging-dev" {
resource "tfe_team_access" "stage-dev" {
access = "write"
team_id = "${tfe_team.developers.id}"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_team_access" "production-dev" {
Expand All @@ -47,10 +47,10 @@ resource "tfe_team_access" "production-ops" {
workspace_id = "${tfe_workspace.production.id}"
}

resource "tfe_team_access" "staging-ops" {
resource "tfe_team_access" "stage-ops" {
access = "admin"
team_id = "${tfe_team.ops.id}"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_team_access" "development-ops" {
Expand All @@ -61,53 +61,53 @@ resource "tfe_team_access" "development-ops" {

resource "tfe_workspace" "development" {
name = "${var.use_case_name}-development"
organization = "${var.org}"
organization = var.org
auto_apply = true
queue_all_runs = false
terraform_version = "0.12.7"
terraform_version = "1.3.5"

vcs_repo {
branch = "development"
identifier = "${var.vcs_identifier}"
oauth_token_id = "${var.oauth_token}"
identifier = var.vcs_identifier
oauth_token_id = var.oauth_token
}
}

resource "tfe_workspace" "staging" {
name = "${var.use_case_name}-staging"
organization = "${var.org}"
resource "tfe_workspace" "stage" {
name = "${var.use_case_name}-stage"
organization = var.org
auto_apply = true
terraform_version = "0.12.7"
terraform_version = "1.3.5"

vcs_repo {
branch = "staging"
identifier = "${var.vcs_identifier}"
oauth_token_id = "${var.oauth_token}"
branch = "stage"
identifier = var.vcs_identifier
oauth_token_id = var.oauth_token
}
}

resource "tfe_workspace" "production" {
name = "${var.use_case_name}-production"
organization = "${var.org}"
terraform_version = "0.12.7"
organization = var.org
terraform_version = "1.3.5"

vcs_repo {
branch = "master"
identifier = "${var.vcs_identifier}"
oauth_token_id = "${var.oauth_token}"
branch = "main"
identifier = var.vcs_identifier
oauth_token_id = var.oauth_token
}
}

resource "tfe_variable" "staging_aws_access_key" {
key = "AWS_ACCESS_KEY_ID"
value = "${var.aws_access_key}"
value = var.aws_access_key
category = "env"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "development_aws_access_key" {
key = "AWS_ACCESS_KEY_ID"
value = "${var.aws_access_key}"
value = var.aws_access_key
category = "env"
workspace_id = "${tfe_workspace.development.id}"
}
Expand All @@ -124,7 +124,7 @@ resource "tfe_variable" "staging_aws_secret_key" {
value = "${var.aws_secret_key}"
category = "env"
sensitive = "true"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "development_aws_secret_key" {
Expand All @@ -148,7 +148,7 @@ resource "tfe_variable" "workspace_var_staging" {
value = "${var.creator_workspace}"
category = "terraform"

workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "workspace_var_development" {
Expand Down Expand Up @@ -185,7 +185,7 @@ resource "tfe_variable" "confirm_destroy2" {
key = "CONFIRM_DESTROY"
value = "1"
category = "env"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "confirm_destroy3" {
Expand All @@ -206,7 +206,7 @@ resource "tfe_variable" "set_ttl2" {
key = "WORKSPACE_TTL"
value = "30"
category = "env"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "set_ttl3" {
Expand All @@ -225,10 +225,10 @@ resource "tfe_variable" "org_var_development" {

resource "tfe_variable" "org_var_staging" {
key = "org"
value = "${var.org}"
value = var.org
category = "terraform"

workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "environment_name_dev" {
Expand All @@ -244,7 +244,7 @@ resource "tfe_variable" "environment_name_stage" {
value = "stage"
category = "terraform"

workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "environment_name_prod" {
Expand All @@ -257,21 +257,21 @@ resource "tfe_variable" "environment_name_prod" {

resource "tfe_variable" "name_dev" {
key = "name"
value = "${var.use_case_name}"
value = var.use_case_name
category = "terraform"
workspace_id = "${tfe_workspace.development.id}"
}

resource "tfe_variable" "name_staging" {
resource "tfe_variable" "name_stage" {
key = "name"
value = "${var.use_case_name}"
value = var.use_case_name
category = "terraform"
workspace_id = "${tfe_workspace.staging.id}"
workspace_id = "${tfe_workspace.stage.id}"
}

resource "tfe_variable" "name_prod" {
key = "name"
value = "${var.use_case_name}"
value = var.use_case_name
category = "terraform"
workspace_id = "${tfe_workspace.production.id}"
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ output "development_subnet_id" {
}

output "staging_subnet_id" {
value = "${aws_subnet.staging.id}"
value = "${aws_subnet.stage.id}"
}

output "production_subnet_id" {
Expand Down
Loading