JetBrains / JetBrains/kotless

deploy task. error: "A name must start with a letter or underscore and may contain only letters"

Open
#80 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1.2k
Forks
54
PR merge metrics
No merged PRs in 30d

Description

I have following build.gradle.kts
```kotlin
import io.kotless.plugin.gradle.dsl.kotless
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.3.72"
id("io.kotless") version "0.1.7-beta-4" apply true
}
group = "org.rtu"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("io.kotless", "kotless-lang", "0.1.7-beta-4")
testImplementation(kotlin("test-junit5"))
}

kotless {
config {
bucket = "kotless-example-bucket1"
prefix = "dev"

terraform {
profile = "default"
region = "eu-central-1"
}
}

webapp {
lambda {
memoryMb = 1024
timeoutSec = 120
}
}
}

tasks.withType() {
kotlinOptions.jvmTarget = "11"
}

```

and following lambda:
```kotlin
@Get("/")
fun root(): String {
return "root"
}
```

when I run ./gradlew deploy I get following teraform errors:
```
./gradlew deploy
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Invalid resource name

on kotless-sample.tf line 51, in resource "aws_iam_role" "1161586659":
51: resource "aws_iam_role" "1161586659" {

A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.

Error: Missing newline after argument

on kotless-sample.tf line 53, in resource "aws_iam_role" "1161586659":
53: assume_role_policy = data.aws_iam_policy_document.1161586659_assume.json

An argument definition must end with a newline.

Error: Invalid resource name

on kotless-sample.tf line 61, in resource "aws_iam_role_policy" "1161586659":
61: resource "aws_iam_role_policy" "1161586659" {

A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.

Error: Invalid resource name

on kotless-sample.tf line 71, in resource "aws_lambda_function" "1161586659":
71: resource "aws_lambda_function" "1161586659" {

A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.

Error: Invalid resource name

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the supplied build.gradle.kts, lambda handler, and ./gradlew deploy command. Inspect the generated kotless-sample.tf around the aws_iam_role, aws_iam_role_policy, and aws_lambda_function resources, then trace where their names are generated. Done means Terraform accepts the generated configuration and deployment proceeds past validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, kotlin, terraform
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.