-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Cannot manage default aws_db_subnet_group #4674
Comments
I'm currently working around this by setting the name to anything other than 'default' and including: lifecycle {
ignore_changes = ["name"]
} |
The problem is that $ terraform import aws_db_subnet_group.default default
aws_db_subnet_group.default: Importing from ID "default"...
aws_db_subnet_group.default: Import complete!
Imported aws_db_subnet_group (ID: default)
aws_db_subnet_group.default: Refreshing state... (ID: default)
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform. write some Terraform code resource "aws_db_subnet_group" "default" {
name = "default"
description = "default"
subnet_ids = [
...
]
} and then $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
aws_db_subnet_group.default: Refreshing state... (ID: default)
------------------------------------------------------------------------
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed. |
I think we'll find the same issue with importing the default
|
Given that this is tagged as ‘new resource’, I’m guessing it’ll go the way of a resource such as “aws_default_db_subnet_group”, similar to eg. aws_default_vpc - given these default resources do behave slightly differently to their ‘normal’ counterparts. Perhaps we might need ‘default’ subnet resources for redshift, neptune and dms as well then. |
Do we know if there is any progress on the topic? |
As far as I remember, my approach for getting the working example in #4674 (comment) was to
func resourceAwsDbSubnetGroupCustomizeDiff(diff *schema.ResourceDiff, meta interface{}) error {
if diff.Id() == "" {
// New resource.
name:= diff.Get("name").(string);
// Same logic as validateDbSubnetGroupName.
}
} |
I'm using resource "aws_db_subnet_group" "default" {
name = "default"
description = "default"
...
} to resource "aws_db_subnet_group" "default" {
description = "default"
...
} |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
First example:
Second example:
Expected Behavior
With the first example, I expected that Terraform would either generate a diff between my config and the live resource, or advise that everything is up-to-date.
With the second example, I would expect the resource needs recreation, which is exactly what happens - I include this just to demonstrate that given that 'default' isn't accepted, it's not possible to directly manage this resource after importing it.
Actual Behavior
With first example config from above:
With second example config from above:
Steps to Reproduce
terraform import aws_db_subnet_group.default default
The text was updated successfully, but these errors were encountered: