Removing name after specified during resource creation:
Create resource with name:
resource "snowsql_exec" "role" {
name = "my_role"
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
output:
# snowsql_exec.role will be created
+ resource "snowsql_exec" "role" {
+ id = (known after apply)
+ name = "my_role"
+ read_results = (sensitive value)
+ create {
+ number_of_statements = (known after apply)
+ statements = "CREATE ROLE IF NOT EXISTS my_role"
}
+ delete {
+ number_of_statements = (known after apply)
+ statements = "DROP ROLE IF EXISTS my_role"
}
}
and remove the name argument:
resource "snowsql_exec" "role" {
# name = "my_role"
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
output:
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# snowsql_exec.role will be updated in-place
~ resource "snowsql_exec" "role" {
id = "my_role"
- name = "my_role" -> null
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
snowsql_exec.role: Modifying... [id=my_role]
snowsql_exec.role: Modifications complete after 0s [id=my_role]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
The original id should persist.
Example 2
create new resource without specifying the name argument:
Create resource with name:
resource "snowsql_exec" "role" {
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
output:
# snowsql_exec.role will be created
+ resource "snowsql_exec" "role" {
+ id = (known after apply)
+ read_results = (sensitive value)
+ create {
+ number_of_statements = (known after apply)
+ statements = "CREATE ROLE IF NOT EXISTS my_role"
}
+ delete {
+ number_of_statements = (known after apply)
+ statements = "DROP ROLE IF EXISTS my_role"
}
}
and add the name argument.
resource "snowsql_exec" "role" {
name = "my_role"
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
output:
snowsql_exec.role: Refreshing state... [id=cfs3dsqnv5cr4jj9bql0]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# snowsql_exec.role will be updated in-place
~ resource "snowsql_exec" "role" {
id = "cfs3dsqnv5cr4jj9bql0"
+ name = "my_role"
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
snowsql_exec.role: Modifying... [id=cfs3dsqnv5cr4jj9bql0]
snowsql_exec.role: Modifications complete after 0s [id=cfs3dsqnv5cr4jj9bql0]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
Feats
81
85
Example 1
Removing name after specified during resource creation:
output:
and remove the
name
argument:output:
The original
id
should persist.Example 2
create new resource without specifying the
name
argument:output:
and add the
name
argument.output:
The original
id
should persist.