-
Notifications
You must be signed in to change notification settings - Fork 984
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
Add support for kubernetes_service_account #17
Conversation
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.
otherwise LGTM :)
AutomountServiceAccountToken: ptrToBool(false), | ||
ObjectMeta: metadata, | ||
ImagePullSecrets: expandLocalObjectReferenceArray(d.Get("image_pull_secret").(*schema.Set).List()), | ||
Secrets: expandServiceAccountSecrets(d.Get("secret").(*schema.Set).List(), ""), |
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.
should this not be passing in default_secret_name
?
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.
We have no default name at this point yet (during initial creation), so there's nothing to add.
}, | ||
"default_secret_name": { | ||
Type: schema.TypeString, | ||
Computed: true, |
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.
given this is being used in the Read method, should this also be optional?
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.
It cannot and should not be specified by the user, so no. It's a computed-only field.
You can call d.Set
on a computed field at any time in the CRUD, the only difference is that user cannot specify it in the tf/HCL config.
log.Printf("[INFO] Checking service account %s", name) | ||
_, err := conn.CoreV1().ServiceAccounts(namespace).Get(name, metav1.GetOptions{}) | ||
if err != nil { | ||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 { |
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.
we could use http.StatusNotFound
here
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.
Aye, we could do and under many circumstances I would, I just feel that for common codes like 200 and 404 it's just not worth it as three digits are shorter and nearly everyone knows what these mean.
Add instruction on terraform init
Test results