Skip to content

Commit 44791a1

Browse files
authored
feat: bump to terraform v12 (#4)
1 parent a267dac commit 44791a1

File tree

5 files changed

+48
-47
lines changed

5 files changed

+48
-47
lines changed

.github/main.workflow

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ action "filter-to-pr-open-synced" {
1414
}
1515

1616
action "terraform-fmt" {
17-
uses = "hashicorp/terraform-github-actions/fmt@v0.1.3"
17+
uses = "hashicorp/terraform-github-actions/fmt@v0.3.5"
1818
needs = "filter-to-pr-open-synced"
1919
secrets = ["GITHUB_TOKEN"]
2020

@@ -24,7 +24,7 @@ action "terraform-fmt" {
2424
}
2525

2626
action "terraform-init" {
27-
uses = "hashicorp/terraform-github-actions/init@v0.1.3"
27+
uses = "hashicorp/terraform-github-actions/init@v0.3.5"
2828
needs = "terraform-fmt"
2929
secrets = ["GITHUB_TOKEN"]
3030

@@ -34,7 +34,7 @@ action "terraform-init" {
3434
}
3535

3636
action "terraform-validate" {
37-
uses = "hashicorp/terraform-github-actions/validate@v0.1.3"
37+
uses = "hashicorp/terraform-github-actions/validate@v0.3.5"
3838
needs = "terraform-init"
3939
secrets = ["GITHUB_TOKEN"]
4040

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ The terraform module for creation and management of a GCP project with normalize
66

77
```hcl
88
module "my_awesome_project" {
9-
source = "git::https://github.com/SweetOps/terraform-google-project.git?ref=master"
10-
name = "awesome"
11-
stage = "production"
12-
namespace = "sweetops"
9+
source = "git::https://github.com/SweetOps/terraform-google-project.git?ref=master"
10+
name = "awesome"
11+
stage = "production"
12+
namespace = "sweetops"
13+
billing_account_id = "21C1F0-PKL92E-E25235"
1314
}
1415
```
1516

@@ -23,7 +24,6 @@ module "my_awesome_project" {
2324
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
2425
| auto_create_network | Create the 'default' network automatically | string | `"true"` | no |
2526
| billing_account_id | The alphanumeric ID of the billing account this project belongs to | string | `""` | no |
26-
| context | Default context to use for passing state between label invocations | map | `<map>` | no |
2727
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `"-"` | no |
2828
| enable_deletion_protection | If true, the Terraform resource can be deleted without deleting the Project via the Google API. | string | `"false"` | no |
2929
| enabled | Set to false to prevent the module from creating any resources | string | `"true"` | no |

main.tf

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
module "label" {
2-
source = "git::https://github.com/SweetOps/terraform-null-label.git?ref=tags/0.6.1"
3-
enabled = "${var.enabled}"
4-
namespace = "${var.namespace}"
5-
name = "${var.name}"
6-
stage = "${var.stage}"
7-
environment = "${var.environment}"
8-
delimiter = "${var.delimiter}"
9-
attributes = "${var.attributes}"
10-
context = "${var.context}"
11-
tags = "${var.tags}"
2+
source = "git::https://github.com/SweetOps/terraform-null-label.git?ref=tags/0.7.0"
3+
enabled = var.enabled
4+
namespace = var.namespace
5+
name = var.name
6+
stage = var.stage
7+
environment = var.environment
8+
delimiter = var.delimiter
9+
attributes = var.attributes
10+
tags = var.tags
1211
}
1312

1413
resource "google_project" "default" {
15-
count = "${var.enabled == "true" ? 1 : 0}"
16-
name = "${module.label.id}"
17-
project_id = "${module.label.id}"
18-
labels = "${module.label.gcp_labels}"
19-
org_id = "${var.org_id}"
20-
folder_id = "${var.folder_id}"
21-
skip_delete = "${var.enable_deletion_protection}"
22-
auto_create_network = "${var.auto_create_network}"
23-
billing_account = "${var.billing_account_id}"
14+
count = var.enabled ? 1 : 0
15+
name = module.label.id
16+
project_id = module.label.id
17+
labels = module.label.gcp_labels
18+
org_id = var.org_id
19+
folder_id = var.folder_id
20+
skip_delete = var.enable_deletion_protection
21+
auto_create_network = var.auto_create_network
22+
billing_account = var.billing_account_id
2423
}

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
output "number" {
2-
value = "${join("", google_project.default.*.number)}"
2+
value = join("", google_project.default.*.number)
33
description = "The numeric identifier of the project"
44
}
55

66
output "name" {
7-
value = "${join("", google_project.default.*.name)}"
7+
value = join("", google_project.default.*.name)
88
description = "The project ID"
99
}

variables.tf

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,77 @@
11
variable "namespace" {
2-
type = "string"
2+
type = string
3+
default = ""
34
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
45
}
56

67
variable "environment" {
7-
type = "string"
8+
type = string
89
default = ""
910
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
1011
}
1112

1213
variable "stage" {
13-
type = "string"
14+
type = string
15+
default = ""
1416
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
1517
}
1618

1719
variable "name" {
18-
type = "string"
20+
type = string
21+
default = ""
1922
description = "Solution name, e.g. 'app' or 'jenkins'"
2023
}
2124

2225
variable "enabled" {
23-
type = "string"
24-
default = "true"
26+
type = bool
27+
default = true
2528
description = "Set to false to prevent the module from creating any resources"
2629
}
2730

2831
variable "delimiter" {
29-
type = "string"
32+
type = string
3033
default = "-"
3134
description = "Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`"
3235
}
3336

3437
variable "attributes" {
35-
type = "list"
38+
type = list(string)
3639
default = []
3740
description = "Additional attributes (e.g. `1`)"
3841
}
3942

4043
variable "tags" {
41-
type = "map"
44+
type = map(string)
4245
default = {}
4346
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
4447
}
4548

46-
variable "context" {
47-
type = "map"
48-
default = {}
49-
description = "Default context to use for passing state between label invocations"
50-
}
51-
5249
variable "org_id" {
50+
type = string
5351
default = ""
5452
description = "The numeric ID of the organization this project belongs to"
5553
}
5654

5755
variable "folder_id" {
56+
type = string
5857
default = ""
5958
description = "The numeric ID of the folder this project should be created under"
6059
}
6160

6261
variable "enable_deletion_protection" {
63-
default = "false"
62+
type = bool
63+
default = false
6464
description = "If true, the Terraform resource can be deleted without deleting the Project via the Google API."
6565
}
6666

6767
variable "auto_create_network" {
68-
default = "true"
68+
type = bool
69+
default = true
6970
description = "Create the 'default' network automatically"
7071
}
7172

7273
variable "billing_account_id" {
73-
description = "The alphanumeric ID of the billing account this project belongs to"
74+
type = string
7475
default = ""
76+
description = "The alphanumeric ID of the billing account this project belongs to"
7577
}

0 commit comments

Comments
 (0)