-
Notifications
You must be signed in to change notification settings - Fork 553
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
don't send password updates if no change #1912
don't send password updates if no change #1912
Conversation
if v, ok := d.GetOk(prefix + "hosts"); ok { | ||
log.Printf("[DEBUG] Cassandra hosts: %v", v.([]interface{})) | ||
var hosts []string | ||
for _, host := range v.([]interface{}) { | ||
if v == nil { | ||
continue | ||
} | ||
hosts = append(hosts, host.(string)) | ||
} | ||
data["hosts"] = strings.Join(hosts, ",") | ||
} | ||
if v, ok := d.GetOkExists(prefix + "port"); ok { | ||
data["port"] = v.(int) | ||
} | ||
if v, ok := d.GetOk(prefix + "username"); ok { | ||
data["username"] = v.(string) | ||
} | ||
if v, ok := d.GetOk("cassandra.0.password"); ok { | ||
data["password"] = v.(string) | ||
} | ||
if v, ok := d.GetOkExists(prefix + "tls"); ok { | ||
data["tls"] = v.(bool) | ||
} | ||
if v, ok := d.GetOkExists("cassandra.0.insecure_tls"); ok { | ||
data["insecure_tls"] = v.(bool) | ||
} | ||
if v, ok := d.GetOkExists("cassandra.0.pem_bundle"); ok { | ||
data["pem_bundle"] = v.(string) | ||
} | ||
if v, ok := d.GetOkExists(prefix + "pem_json"); ok { | ||
data["pem_json"] = v.(string) | ||
} | ||
if v, ok := d.GetOkExists(prefix + "protocol_version"); ok { | ||
data["protocol_version"] = v.(int) | ||
} | ||
if v, ok := d.GetOkExists(prefix + "connect_timeout"); ok { | ||
data["connect_timeout"] = v.(int) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this block was moved to its own function
if v, ok := d.GetOk(prefix + "public_key"); ok { | ||
data["public_key"] = v.(string) | ||
} | ||
if v, ok := d.GetOk(prefix + "private_key"); ok { | ||
data["private_key"] = v.(string) | ||
} | ||
if v, ok := d.GetOk(prefix + "project_id"); ok { | ||
data["project_id"] = v.(string) | ||
} | ||
setMongoDBAtlasDatabaseConnectionData(d, prefix, data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this block was moved to its own function
docker-compose.yaml
Outdated
ports: | ||
- "9042:9042" | ||
volumes: | ||
- ./cassandra.yaml:/etc/cassandra/cassandra.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we move the cassandra.yaml file out of the top-level directory? Since it is only for testing, I find it to be out of place here. Maybe we could put it in ./testdata
?
@@ -823,6 +824,27 @@ func TestAccDatabaseSecretBackendConnection_elasticsearch(t *testing.T) { | |||
resource.TestCheckResourceAttr(testDefaultDatabaseSecretBackendResource, "elasticsearch.0.tls_server_name", "test"), | |||
), | |||
}, | |||
{ | |||
PreConfig: func() { | |||
// Uncomment block below to actually rotate root. We're avoiding doing this in CI test runs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to enable this, we could create a Vault user specifically for this tests. Example: https://github.com/hashicorp/vault-plugin-database-elasticsearch#create-a-role-for-vault
I don't think it is strictly necessary though since the behavior seems well tested enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Closes #1629 (again).
Prevents sending the password to Vault when there is no change in the Terraform state.
Updates the remaining database engines:
Elasticache was left out since it doesn't use a traditional password as far as I can tell. I believe it's just an alias for the AWS Secret Key.
In addition:
docker-compose.yml
to include database engines for easier testing