prep v40.0.0
This commit is contained in:
@@ -25,6 +25,35 @@ Gitlab hostname and SSH port on the `gitlab_config` section.
|
||||
|
||||
## Variable configuration
|
||||
|
||||
### Gitlab Config
|
||||
|
||||
The `gitlab_config` variable defines where projects will be hosted.
|
||||
GitLab can either be the SaaS offering (with the default hostname `gitlab.com`)
|
||||
or a self-hosted instance with a custom FQDN. If hostname is set to gitlab.com, you must
|
||||
also set the `saas_group` variable to specify the group path where resources will be created.
|
||||
|
||||
This is an example that configures a SaaS gitlab instance using `my_group/gcp` as default group :
|
||||
|
||||
```hcl
|
||||
gitlab_config = {
|
||||
access_token = "glpat-XXX"
|
||||
hostname = "gitlab.com"
|
||||
ssh_port = 22
|
||||
saas_group = "my_group/gcp"
|
||||
}
|
||||
# tftest skip
|
||||
```
|
||||
|
||||
This is an example that configures an on-premise gitlab instance :
|
||||
|
||||
```hcl
|
||||
gitlab_config = {
|
||||
access_token = "glpat-XXX"
|
||||
hostname = "my-gitlab.example.com"
|
||||
}
|
||||
# tftest skip
|
||||
```
|
||||
|
||||
### Modules project and sources
|
||||
|
||||
The `modules_config` variable controls creation and management of both the
|
||||
@@ -374,11 +403,11 @@ check if the plan pipeline executes successfully.
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [gitlab_config](variables.tf#L28) | Gitlab config. | <code title="object({ access_token = string hostname = optional(string, "gitlab.gcp.example.com") ssh_port = optional(number, 2222) })">object({…})</code> | ✓ | |
|
||||
| [groups](variables.tf#L37) | Gitlab groups. | <code title="map(object({ name = string path = string description = string }))">map(object({…}))</code> | ✓ | |
|
||||
| [gitlab_config](variables.tf#L28) | Gitlab config. | <code title="object({ access_token = string hostname = optional(string, "gitlab.com") ssh_port = optional(number, 22) saas_group = optional(string, "") })">object({…})</code> | ✓ | |
|
||||
| [groups](variables.tf#L45) | Gitlab groups. | <code title="map(object({ name = string path = string description = string }))">map(object({…}))</code> | ✓ | |
|
||||
| [commit_config](variables.tf#L17) | Configure commit metadata. | <code title="object({ author = optional(string, "FAST loader") email = optional(string, "fast-loader@fast.gcp.tf") message = optional(string, "FAST initial loading") })">object({…})</code> | | <code>{}</code> |
|
||||
| [modules_config](variables.tf#L46) | Gitlab modules config. | <code title="object({ bootstrap = optional(bool, true) module_prefix = optional(string, "") group = optional(string) project_name = string source_ref = optional(string) key_config = optional(object({ create_key = optional(bool, false) create_secrets = optional(bool, false) keypair_path = optional(string) }), {}) })">object({…})</code> | | <code>null</code> |
|
||||
| [projects](variables.tf#L71) | Gitlab projects to create. | <code title="map(object({ create_options = optional(object({ allow = optional(object({ auto_merge = optional(bool) merge_commit = optional(bool) rebase_merge = optional(bool) squash_merge = optional(bool) })) auto_init = optional(bool) description = optional(string) features = optional(object({ issues = optional(bool) projects = optional(bool) wiki = optional(bool) })) templates = optional(object({ gitignore = optional(string, "Terraform") license = optional(string) repository = optional(object({ name = string owner = string })) }), {}) visibility = optional(string, "private") })) group = string populate_from = optional(string) populate_samples = optional(bool, false) workflow_file = optional(string, null) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [modules_config](variables.tf#L54) | Gitlab modules config. | <code title="object({ bootstrap = optional(bool, true) module_prefix = optional(string, "") group = optional(string) project_name = string source_ref = optional(string) key_config = optional(object({ create_key = optional(bool, false) create_secrets = optional(bool, false) keypair_path = optional(string) }), {}) })">object({…})</code> | | <code>null</code> |
|
||||
| [projects](variables.tf#L79) | Gitlab projects to create. | <code title="map(object({ create_options = optional(object({ allow = optional(object({ auto_merge = optional(bool) merge_commit = optional(bool) rebase_merge = optional(bool) squash_merge = optional(bool) })) auto_init = optional(bool) description = optional(string) features = optional(object({ issues = optional(bool) projects = optional(bool) wiki = optional(bool) })) templates = optional(object({ gitignore = optional(string, "Terraform") license = optional(string) repository = optional(object({ name = string owner = string })) }), {}) visibility = optional(string, "private") })) group = string populate_from = optional(string) populate_samples = optional(bool, false) workflow_file = optional(string, null) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ locals {
|
||||
] : []),
|
||||
[for f in fileset(path.module, "${v.populate_from}/*.tf") : f],
|
||||
[for f in fileset(path.module, "${v.populate_from}/templates/*.tpl") : f],
|
||||
[for f in fileset(path.module, "${v.populate_from}/templates/*.yaml") : f],
|
||||
[for f in fileset(path.module, "${v.populate_from}/schemas/*.json") : f],
|
||||
[for f in fileset(path.module, "${v.populate_from}/terraform.tfvars") : f]
|
||||
) : {
|
||||
project = k
|
||||
@@ -36,6 +38,9 @@ locals {
|
||||
}
|
||||
] if v.populate_from != null
|
||||
])
|
||||
gitlab_ssh_prefix = "git::ssh://git@${var.gitlab_config.hostname}:${var.gitlab_config.ssh_port}/"
|
||||
gitlab_base_path = var.gitlab_config.hostname == "gitlab.com" ? "${var.gitlab_config.saas_group}/" : ""
|
||||
gitlab_base_url = "${local.gitlab_ssh_prefix}${local.gitlab_base_path}${local.modules_group}/${local.modules_project}.git"
|
||||
modules_files = {
|
||||
for f in concat(
|
||||
[for f in fileset(path.module, "../../../modules/*/*.svg") : f],
|
||||
@@ -61,7 +66,7 @@ locals {
|
||||
for k in local._repository_files :
|
||||
"${k.project}/${k.name}" => k
|
||||
if !endswith(k.name, ".tf") || (
|
||||
!startswith(k.name, "0") && k.name != "globals.tf"
|
||||
!startswith(k.name, "0") && !startswith(k.name, "1") && !startswith(k.name, "2") && k.name != "globals.tf"
|
||||
)
|
||||
},
|
||||
{
|
||||
@@ -76,11 +81,17 @@ locals {
|
||||
)
|
||||
}
|
||||
|
||||
data "gitlab_group" "saas" {
|
||||
count = var.gitlab_config.hostname == "gitlab.com" ? 1 : 0
|
||||
full_path = var.gitlab_config.saas_group
|
||||
}
|
||||
|
||||
resource "gitlab_group" "default" {
|
||||
for_each = var.groups
|
||||
name = each.value.name
|
||||
path = each.value.path
|
||||
description = each.value.description
|
||||
parent_id = var.gitlab_config.hostname == "gitlab.com" ? data.gitlab_group.saas[0].id : null
|
||||
}
|
||||
|
||||
resource "gitlab_project" "modules" {
|
||||
@@ -161,7 +172,7 @@ resource "gitlab_repository_file" "default" {
|
||||
? base64encode(replace(
|
||||
file(each.value.file),
|
||||
"/source(\\s*)=\\s*\"../../../modules/([^/\"]+)\"/",
|
||||
"source$1= \"git::ssh://git@${var.gitlab_config.hostname}:${var.gitlab_config.ssh_port}/${local.modules_group}/${local.modules_project}.git//${local.module_prefix}$2${local.modules_ref}\"" # "
|
||||
"source$1= \"${local.gitlab_base_url}//${local.module_prefix}$2${local.modules_ref}\""
|
||||
))
|
||||
: endswith(each.value.name, ".png") || endswith(each.value.name, ".gif") || endswith(each.value.name, ".svg") ? filebase64(each.value.file) : base64encode(file(each.value.file))
|
||||
)
|
||||
|
||||
@@ -18,6 +18,6 @@ output "clone" {
|
||||
description = "Clone projects commands."
|
||||
value = {
|
||||
for k, v in var.projects :
|
||||
k => "ssh://git@${var.gitlab_config.hostname}:${var.gitlab_config.ssh_port}/${v.group}/${k}.git"
|
||||
k => "ssh://git@${var.gitlab_config.hostname}:${var.gitlab_config.ssh_port}/${(var.gitlab_config.saas_group != "" ? "${var.gitlab_config.saas_group}/${v.group}" : "${v.group}")}/${k}.git"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
gitlab_config = {
|
||||
access_token = "{token}"
|
||||
access_token = "glpat-XXXXXXXXXXXXXXXXXXXXXXXX"
|
||||
hostname = "gitlab.com"
|
||||
ssh_port = 22
|
||||
saas_group = "XXX" # Replace with path GitLab group
|
||||
}
|
||||
|
||||
modules_config = {
|
||||
project_name = "modules"
|
||||
key_config = {
|
||||
|
||||
@@ -29,9 +29,17 @@ variable "gitlab_config" {
|
||||
description = "Gitlab config."
|
||||
type = object({
|
||||
access_token = string
|
||||
hostname = optional(string, "gitlab.gcp.example.com")
|
||||
ssh_port = optional(number, 2222)
|
||||
hostname = optional(string, "gitlab.com")
|
||||
ssh_port = optional(number, 22)
|
||||
saas_group = optional(string, "")
|
||||
})
|
||||
validation {
|
||||
condition = (
|
||||
(var.gitlab_config.hostname == "gitlab.com" && var.gitlab_config.saas_group != "") ||
|
||||
(var.gitlab_config.hostname != "gitlab.com" && var.gitlab_config.saas_group == "")
|
||||
)
|
||||
error_message = "Gitlab Saas parent group must be define."
|
||||
}
|
||||
}
|
||||
|
||||
variable "groups" {
|
||||
|
||||
6
fast/project-templates/managed-kafka/versions.tf
generated
6
fast/project-templates/managed-kafka/versions.tf
generated
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Fabric release: v40.0.0-rc1
|
||||
# Fabric release: v40.0.0
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.10.2"
|
||||
@@ -27,9 +27,9 @@ terraform {
|
||||
}
|
||||
}
|
||||
provider_meta "google" {
|
||||
module_name = "google-pso-tool/cloud-foundation-fabric/fast/project-templates/managed-kafka:v40.0.0-rc1-tf"
|
||||
module_name = "google-pso-tool/cloud-foundation-fabric/path:v40.0.0-tf"
|
||||
}
|
||||
provider_meta "google-beta" {
|
||||
module_name = "google-pso-tool/cloud-foundation-fabric/fast/project-templates/managed-kafka:v40.0.0-rc1-tf"
|
||||
module_name = "google-pso-tool/cloud-foundation-fabric/path:v40.0.0-tf"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user