diff --git a/terraform/eks/daemon/fluent/windows/main.tf b/terraform/eks/daemon/fluent/windows/main.tf index dde0d010c..f7b7858cd 100644 --- a/terraform/eks/daemon/fluent/windows/main.tf +++ b/terraform/eks/daemon/fluent/windows/main.tf @@ -320,6 +320,7 @@ resource "kubernetes_cluster_role_binding" "rolebinding" { } resource "kubernetes_config_map" "cwagentconfig" { + depends_on = [kubernetes_namespace.namespace] metadata { name = "cwagentconfig" namespace = "amazon-cloudwatch" @@ -525,6 +526,7 @@ resource "kubernetes_config_map" "cluster_info" { } resource "kubernetes_service_account" "fluentbit_service" { + depends_on = [kubernetes_namespace.namespace] metadata { name = "fluent-bit" namespace = "amazon-cloudwatch" diff --git a/terraform/eks/daemon/fluent/windows/providers.tf b/terraform/eks/daemon/fluent/windows/providers.tf index bf99b8f3d..133916dd0 100644 --- a/terraform/eks/daemon/fluent/windows/providers.tf +++ b/terraform/eks/daemon/fluent/windows/providers.tf @@ -9,9 +9,9 @@ provider "kubernetes" { exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" - args = ["eks", "get-token", "--cluster-name", module.fluent_common.cluster_name] + args = ["eks", "get-token", "--cluster-name", aws_eks_cluster.cluster.name] } - host = module.fluent_common.cluster_endpoint - cluster_ca_certificate = base64decode(module.fluent_common.cluster_cert) - token = module.fluent_common.cluster_auth_token + host = aws_eks_cluster.cluster.endpoint + cluster_ca_certificate = base64decode(aws_eks_cluster.cluster.certificate_authority.0.data) + token = data.aws_eks_cluster_auth.cluster_auth.token } \ No newline at end of file diff --git a/test/fluent/fluent_test.go b/test/fluent/fluent_test.go index 951a72ed8..c2074626f 100644 --- a/test/fluent/fluent_test.go +++ b/test/fluent/fluent_test.go @@ -17,7 +17,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent-test/util/awsservice" ) -const logStreamRetry = 20 +const logStreamRetry = 10 // fluent log group with expected log message fields var logGroupToKey = map[string][][]string{ @@ -61,10 +61,19 @@ func TestFluentLogs(t *testing.T) { logGroupToKey = logGroupToKeyWindows } + currRetries := 0 now := time.Now() for group, fieldsArr := range logGroupToKey { group = fmt.Sprintf("/aws/containerinsights/%s/%s", env.EKSClusterName, group) - if !awsservice.IsLogGroupExists(group) { + for currRetries < logStreamRetry { + if awsservice.IsLogGroupExists(group) { + break + } else { + currRetries++ + time.Sleep(time.Duration(currRetries) * time.Second) + } + } + if currRetries >= logStreamRetry { t.Fatalf("fluent log group doesn't exsit: %s", group) }